diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2022-01-26 13:05:47 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-26 12:08:53 -0800 |
commit | 7700ab087b82f71d19134141045b95063e407344 (patch) | |
tree | 2d62f412b26cc08708c9fe6d633b5bf64e05b10d /builtin | |
parent | reset_head(): take struct rebase_head_opts (diff) | |
download | tgif-7700ab087b82f71d19134141045b95063e407344.tar.xz |
rebase --apply: fix reflog
move_to_original_branch() passes the message intended for the branch
reflog as `orig_head_msg`. Fix this by adding a `branch_msg` member to
struct reset_head_opts and add a regression test. Note that these
reflog messages do not respect GIT_REFLOG_ACTION. They are not alone
in that and will be fixed in a future series.
The "merge" backend already has tests that check both the branch and
HEAD reflogs.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/rebase.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index ecc368dd4f..b55a9cff05 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -570,7 +570,7 @@ static int finish_rebase(struct rebase_options *opts) static int move_to_original_branch(struct rebase_options *opts) { - struct strbuf orig_head_reflog = STRBUF_INIT, head_reflog = STRBUF_INIT; + struct strbuf branch_reflog = STRBUF_INIT, head_reflog = STRBUF_INIT; struct reset_head_opts ropts = { 0 }; int ret; @@ -580,17 +580,17 @@ static int move_to_original_branch(struct rebase_options *opts) if (!opts->onto) BUG("move_to_original_branch without onto"); - strbuf_addf(&orig_head_reflog, "rebase finished: %s onto %s", + strbuf_addf(&branch_reflog, "rebase finished: %s onto %s", opts->head_name, oid_to_hex(&opts->onto->object.oid)); strbuf_addf(&head_reflog, "rebase finished: returning to %s", opts->head_name); ropts.branch = opts->head_name; ropts.flags = RESET_HEAD_REFS_ONLY; - ropts.orig_head_msg = orig_head_reflog.buf; + ropts.branch_msg = branch_reflog.buf; ropts.head_msg = head_reflog.buf; ret = reset_head(the_repository, &ropts); - strbuf_release(&orig_head_reflog); + strbuf_release(&branch_reflog); strbuf_release(&head_reflog); return ret; } |