]> git.ipfire.org Git - thirdparty/git.git/commit
t5516: test updateInstead with worktree and unborn bare HEAD
authorRunxi Yu <me@runxiyu.org>
Mon, 30 Mar 2026 11:18:20 +0000 (13:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2026 19:52:40 +0000 (12:52 -0700)
commit80871f356e88d23cc32cd852fd4a4548e861f47c
tree20b6dfb47515d3ce2c0a5c10ae4d387639ecc727
parent5361983c075154725be47b65cca9a2421789e410
t5516: test updateInstead with worktree and unborn bare HEAD

This is a regression test which should presently fail, to demonstrate
the behavior I encountered that looks like a bug.

When a bare repository has a worktree checked out on a separate branch,
receive.denyCurrentBranch=updateInstead should allow a push to that
branch and update the linked worktree, as long as the linked worktree is
clean.

But, if the bare repository's own HEAD is repointed to an unborn branch,
the push is rejected with "Working directory has staged changes", even
though the linked worktree itself is clean.

This test is essentially a minimal working example of what I encountered
while actually using Git; it might not be the optimal way to demonstrate
the underlying bug. I suspect builtin/receive-pack.c is using the bare
repository's HEAD even when comparing it to the worktree's index.

Signed-off-by: Runxi Yu <me@runxiyu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5516-fetch-push.sh