aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPablo Sabater <pabloosabaterr@gmail.com>2026-03-30 13:18:22 +0200
committerJunio C Hamano <gitster@pobox.com>2026-03-30 12:52:41 -0700
commit8151f4fe7e4bf36f2656ae849a4ffaf386708178 (patch)
treed5135a2fa9927c81158639a258a1cffcc375f3ff /t
parentb310755ecaf4459eddd4f602b3cb02e793c01177 (diff)
downloadgit-8151f4fe7e4bf36f2656ae849a4ffaf386708178.tar.xz
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>
Diffstat (limited to 't')
-rwxr-xr-xt/t5516-fetch-push.sh6
1 files changed, 1 insertions, 5 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index c40f2790d8..117cfa051f 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1817,11 +1817,7 @@ test_expect_success 'denyCurrentBranch and bare repository worktrees' '
test_must_fail git push --delete bare.git wt
'
-# NEEDSWORK: updateInstead unexpectedly fails when bare HEAD points to unborn
-# branch (or probably any ref that differs from the target worktree) despite
-# the target worktree being clean. This seems to be because receive-pack.c
-# diffs the target worktree index against the bare repository HEAD.
-test_expect_failure 'updateInstead with bare repository worktree and unborn bare HEAD' '
+test_expect_success 'updateInstead with bare repository worktree and unborn bare HEAD' '
test_when_finished "rm -fr bare.git cloned" &&
git clone --bare . bare.git &&
git -C bare.git worktree add wt &&