]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'en/sequencer-edit-upon-conflict-fix'
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Apr 2021 20:23:25 +0000 (13:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Apr 2021 20:23:26 +0000 (13:23 -0700)
"git cherry-pick/revert" with or without "--[no-]edit" did not spawn
the editor as expected (e.g. "revert --no-edit" after a conflict
still asked to edit the message), which has been corrected.

* en/sequencer-edit-upon-conflict-fix:
  sequencer: fix edit handling for cherry-pick and revert messages

1  2 
sequencer.c

diff --cc sequencer.c
index b4c63ae207e32c4579c808c34bf0f8737d85b375,8ef597ac3a9ea04abdbdfbe08420dee9a653dcfd..fd183b5593bcc1c3558350d9e9d12118afdf6417
@@@ -2032,8 -1860,20 +2032,19 @@@ static void record_in_rewritten(struct 
                flush_rewritten_pending();
  }
  
+ static int should_edit(struct replay_opts *opts) {
+       if (opts->edit < 0)
+               /*
+                * Note that we only handle the case of non-conflicted
+                * commits; continue_single_pick() handles the conflicted
+                * commits itself instead of calling this function.
+                */
+               return (opts->action == REPLAY_REVERT && isatty(0)) ? 1 : 0;
+       return opts->edit;
+ }
  static int do_pick_commit(struct repository *r,
 -                        enum todo_command command,
 -                        struct commit *commit,
 +                        struct todo_item *item,
                          struct replay_opts *opts,
                          int final_fixup, int *check_todo)
  {