]> git.ipfire.org Git - thirdparty/git.git/commit
rebase: pass correct arguments to post-checkout hook
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 26 Jan 2022 13:05:38 +0000 (13:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jan 2022 20:08:52 +0000 (12:08 -0800)
commit69f4c23009ee30faeb61a831f4265791c945783e
tree4521a6bcadf828e73d54b9e5f30c1c686a2623d2
parentbd55eee04b698af6c10c77b24f88601814771ac8
rebase: pass correct arguments to post-checkout hook

If a rebase started with "rebase [--apply|--merge] <upstream> <branch>"
detects that <upstream> is an ancestor of <branch> then it fast-forwards
and checks out <branch>. Unfortunately in that case it passed the null
oid as the first argument to the post-checkout hook rather than the oid
of HEAD.

A side effect of this change is that the call to update_ref() which
updates HEAD now always receives the old value of HEAD. This provides
protection against another process updating HEAD during the checkout.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reset.c
t/t5403-post-checkout-hook.sh