Message ID | f4e6e94bc2c894f369546d16d147d970b71554e7.1645441854.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | rebase: make reflog messages independent of the backend | expand |
On Mon, Feb 21, 2022 at 3:19 PM Phillip Wood via GitGitGadget <gitgitgadget@gmail.com> wrote: > > From: Phillip Wood <phillip.wood@dunelm.org.uk> > > 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. Nice catch, and cool that the fix was so simple. > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> > --- > builtin/rebase.c | 2 -- > t/t3406-rebase-message.sh | 24 ++++++++++++++++++++++++ > 2 files changed, 24 insertions(+), 2 deletions(-) > > diff --git a/builtin/rebase.c b/builtin/rebase.c > index cd9a4f3e2f1..36863117fba 100644 > --- a/builtin/rebase.c > +++ b/builtin/rebase.c > @@ -1273,8 +1273,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; > diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh > index 3ca2fbb0d59..8aa6a79acc1 100755 > --- a/t/t3406-rebase-message.sh > +++ b/t/t3406-rebase-message.sh > @@ -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 > -- > gitgitgadget >
diff --git a/builtin/rebase.c b/builtin/rebase.c index cd9a4f3e2f1..36863117fba 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1273,8 +1273,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; diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index 3ca2fbb0d59..8aa6a79acc1 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -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