felipec / git-reintegrate

Tool that allows the regeneration of integration branches
22 stars 8 forks source link

"fixup" ignores resolved resolution #13

Open ydirson opened 4 years ago

ydirson commented 4 years ago

reintegration.autocontinue does not seem to be honored by fixups:

(redacted for local paths)

$ git reintegrate --continue
* Merging branch multiclient...
* Fixing up with fixups/<ref>
Auto-merging <file>
CONFLICT (content): Merge conflict in <file>
error: could not apply 2e5ae1b... fixup! Merge branch 'multiclient' into experimental
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
Resolved '<file>' using previous resolution.
failed to fixup

Once you have resolved this, run:

  git reintegrate --continue

NOTE: Any changes to the instruction sheet will not be saved.
ydirson commented 4 years ago

Oh, and that's probably related: once we solve the conflict, "reintegrate continue" goes on retrying the same fixup, in a loop we can't exit short of using --abort.

The way out will be to refresh the fixup commit before aborting, so the next run will succeed, but I'm not sure we want to make this mandatory.

felipec commented 3 years ago

Can you try the following patch?

--- a/git-reintegrate
+++ b/git-reintegrate
@@ -475,7 +475,14 @@ def cmd_fixup(message, fixup_commit, *args)

   system(*%w[git cherry-pick --no-commit], fixup_commit) &&
   system({ 'EDITOR' => ':' }, *%w[git commit --amend -a])
-  raise Integration::Stop, '' unless $?.success?
+  if not $?.success?
+    if $autocontinue && %x[git rerere remaining].chomp == ''
+      system(*%w[git cherry-pick --continue])
+      raise Integration::Stop, '' unless $?.success?
+    else
+      raise Integration::Stop, ''
+    end
+  end
 end

 def cmd_commit(message, *args)