aboutsummaryrefslogtreecommitdiff
path: root/t/t5516-fetch-push.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5516-fetch-push.sh')
-rwxr-xr-xt/t5516-fetch-push.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 29e2f17608..117cfa051f 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1792,6 +1792,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
'
test_expect_success 'denyCurrentBranch and worktrees' '
+ test_when_finished "rm -fr cloned && git worktree remove --force new-wt" &&
git worktree add new-wt &&
git clone . cloned &&
test_commit -C cloned first &&
@@ -1816,6 +1817,20 @@ test_expect_success 'denyCurrentBranch and bare repository worktrees' '
test_must_fail git push --delete bare.git wt
'
+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 &&
+ git -C bare.git config receive.denyCurrentBranch updateInstead &&
+ git -C bare.git symbolic-ref HEAD refs/heads/unborn &&
+ test_must_fail git -C bare.git rev-parse -q --verify HEAD^{commit} &&
+ git clone . cloned &&
+ test_commit -C cloned mozzarella &&
+ git -C cloned push ../bare.git HEAD:wt &&
+ test_path_exists bare.git/wt/mozzarella.t &&
+ test "$(git -C cloned rev-parse HEAD)" = "$(git -C bare.git/wt rev-parse HEAD)"
+'
+
test_expect_success 'refuse fetch to current branch of worktree' '
test_when_finished "git worktree remove --force wt && git branch -D wt" &&
git worktree add wt &&