]> git.ipfire.org Git - thirdparty/git.git/commitdiff
rebase --merge: fix reflog message after skipping
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 12 Oct 2022 09:35:08 +0000 (09:35 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Oct 2022 19:55:03 +0000 (12:55 -0700)
The reflog message for every pick after running "rebase --skip" looks
like

rebase (skip) (pick): commit subject line

Fix this by not appending " (skip)" to the reflog action.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rebase.c
t/t3406-rebase-message.sh

index 414526f83a898e59d71903d553ce1aa262369faf..c1e68173b5ffcd9834f8238d6e7d6b8a0ac2cf61 100644 (file)
@@ -1297,8 +1297,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                struct string_list merge_rr = STRING_LIST_INIT_DUP;
 
                options.action = "skip";
-               set_reflog_action(&options);
-
                rerere_clear(the_repository, &merge_rr);
                string_list_clear(&merge_rr, 1);
                ropts.flags = RESET_HEAD_HARD;
index 3ca2fbb0d59b870a55777e57075ac517aa43f41c..8aa6a79acc13fef1eb7951d65e6259d1c9c06633 100755 (executable)
@@ -163,6 +163,30 @@ test_reflog () {
        # check there is only one new entry in the branch reflog
        test_cmp_rev fast-forward@{1} X
        '
+
+       test_expect_success "rebase $mode --skip reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
+       git checkout conflicts &&
+       test_when_finished "git reset --hard Q" &&
+
+       (
+               if test -n "$reflog_action"
+               then
+                       GIT_REFLOG_ACTION="$reflog_action" &&
+                       export GIT_REFLOG_ACTION
+               fi &&
+               test_must_fail git rebase $mode main &&
+               git rebase --skip
+       ) &&
+
+       git log -g --format=%gs -4 >actual &&
+       write_reflog_expect <<-EOF &&
+       ${reflog_action:-rebase} (finish): returning to refs/heads/conflicts
+       ${reflog_action:-rebase} (pick): Q
+       ${reflog_action:-rebase} (pick): P
+       ${reflog_action:-rebase} (start): checkout main
+       EOF
+       test_cmp expect actual
+       '
 }
 
 test_reflog --merge