]> git.ipfire.org Git - thirdparty/git.git/commit
receive-pack: use worktree HEAD for updateInstead
authorPablo Sabater <pabloosabaterr@gmail.com>
Mon, 30 Mar 2026 11:18:22 +0000 (13:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2026 19:52:41 +0000 (12:52 -0700)
commit8151f4fe7e4bf36f2656ae849a4ffaf386708178
treed5135a2fa9927c81158639a258a1cffcc375f3ff
parentb310755ecaf4459eddd4f602b3cb02e793c01177
receive-pack: use worktree HEAD for updateInstead

When a bare repo has linked worktrees, and its HEAD points to an unborn branch,
pushing to a wt branch with updateInstead fails and rejects the push, even if
the wt is clean. This happens because HEAD is checked only for the bare repo
context, instead of the wt.

Remove head_has_history and check for worktree->head_oid which does
have the correct HEAD of the wt.

Update the test added by Runxi's patch to expect success.

Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
t/t5516-fetch-push.sh