From: Junio C Hamano Date: Wed, 25 Mar 2020 20:57:43 +0000 (-0700) Subject: Merge branch 'pw/advise-rebase-skip' X-Git-Tag: v2.27.0-rc0~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f085189f145d1092b43223b72992e851fb412895;p=thirdparty%2Fgit.git Merge branch 'pw/advise-rebase-skip' The mechanism to prevent "git commit" from making an empty commit or amending during an interrupted cherry-pick was broken during the rewrite of "git rebase" in C, which has been corrected. * pw/advise-rebase-skip: commit: give correct advice for empty commit during a rebase commit: encapsulate determine_whence() for sequencer commit: use enum value for multiple cherry-picks sequencer: write CHERRY_PICK_HEAD for reword and edit cherry-pick: check commit error messages cherry-pick: add test for `--skip` advice in `git commit` t3404: use test_cmp_rev --- f085189f145d1092b43223b72992e851fb412895 diff --cc sequencer.c index e528225e78,47e36b6a3c..55b9e047ef --- a/sequencer.c +++ b/sequencer.c @@@ -1953,19 -1955,12 +1969,20 @@@ static int do_pick_commit(struct reposi if (allow < 0) { res = allow; goto leave; - } else if (allow) + } else if (allow == 1) { flags |= ALLOW_EMPTY; - if (!opts->no_commit) { + } else if (allow == 2) { + drop_commit = 1; + unlink(git_path_cherry_pick_head(r)); + unlink(git_path_merge_msg(r)); + fprintf(stderr, + _("dropping %s %s -- patch contents already upstream\n"), + oid_to_hex(&commit->object.oid), msg.subject); + } /* else allow == 0 and there's nothing special to do */ + if (!opts->no_commit && !drop_commit) { if (author || command == TODO_REVERT || (flags & AMEND_MSG)) - res = do_commit(r, msg_file, author, opts, flags); + res = do_commit(r, msg_file, author, opts, flags, + commit? &commit->object.oid : NULL); else res = error(_("unable to parse commit author")); *check_todo = !!(flags & EDIT_MSG); diff --cc sequencer.h index 718a07426d,e56e29ceea..0bee85093e --- a/sequencer.h +++ b/sequencer.h @@@ -8,10 -9,8 +9,9 @@@ struct commit struct repository; const char *git_path_commit_editmsg(void); - const char *git_path_seq_dir(void); const char *rebase_path_todo(void); const char *rebase_path_todo_backup(void); +const char *rebase_path_dropped(void); #define APPEND_SIGNOFF_DEDUP (1u << 0)