]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pw/advise-rebase-skip'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2020 20:57:43 +0000 (13:57 -0700)
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

1  2 
builtin/commit.c
sequencer.c
sequencer.h
t/t3404-rebase-interactive.sh
t/t3507-cherry-pick-conflict.sh

Simple merge
diff --cc sequencer.c
index e528225e787f4e26de604807efc798e8b967010e,47e36b6a3c441d9d6adbe8664b623ffb572f9cac..55b9e047ef3328d7b5f37a48137032e1c0334350
@@@ -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 718a07426dae930dc07417f902fa1ad5682eb337,e56e29ceea26627fc26ae935496e3ce8e6e0ea4a..0bee85093e5391ad8bf111f20194c03e7d1b2774
@@@ -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)
  
Simple merge
Simple merge