diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2022-01-26 14:05:48 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-26 21:08:53 +0100 |
commit | cd1528ef8ef9847fc27cff4016bf073f04729504 (patch) | |
tree | 54e0d712139312788ffc4929e8352d042c60944f /reset.h | |
parent | rebase --apply: fix reflog (diff) | |
download | git-cd1528ef8ef9847fc27cff4016bf073f04729504.tar.xz git-cd1528ef8ef9847fc27cff4016bf073f04729504.zip |
rebase --apply: set ORIG_HEAD correctly
At the start of a rebase, ORIG_HEAD is updated to the tip of the
branch being rebased. Unfortunately reset_head() always uses the
current value of HEAD for this which is incorrect if the rebase is
started with "git rebase <upstream> <branch>" as in that case
ORIG_HEAD should be updated to <branch>. This only affects the "apply"
backend as the "merge" backend does not yet use reset_head() for the
initial checkout. Fix this by passing in orig_head when calling
reset_head() and add some regression tests.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reset.h')
-rw-r--r-- | reset.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -23,6 +23,10 @@ struct reset_head_opts { */ const struct object_id *oid; /* + * Optional value to set ORIG_HEAD. Defaults to HEAD. + */ + const struct object_id *orig_head; + /* * Optional branch to switch to. */ const char *branch; |