path: root/t/
diff options
authorJunio C Hamano <>2020-03-05 18:43:02 (GMT)
committerJunio C Hamano <>2020-03-05 18:43:03 (GMT)
commit4a2e91db652e197803c6f29e2c2f1c9dfbc16506 (patch)
treeabae7a1c8eb6eeb0d57f561725122341c3e07fe7 /t/
parent49e5043b09fffb0411e8bae19d60014e72a36fd0 (diff)
parent4d864895a23bbbb5403d9aa8a65d0576d2029597 (diff)
Merge branch 'hv/receive-denycurrent-everywhere'
"git push" should stop from updating a branch that is checked out when receive.denyCurrentBranch configuration is set, but it failed to pay attention to checkouts in secondary worktrees. This has been corrected. * hv/receive-denycurrent-everywhere: t2402: test worktree path when called in .git directory receive.denyCurrentBranch: respect all worktrees t5509: use a bare repository for test push target get_main_worktree(): allow it to be called in the Git directory
Diffstat (limited to 't/')
1 files changed, 11 insertions, 0 deletions
diff --git a/t/ b/t/
index f12cbef..9ff041a 100755
--- a/t/
+++ b/t/
@@ -1712,4 +1712,15 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
+test_expect_success 'denyCurrentBranch and worktrees' '
+ git worktree add new-wt &&
+ git clone . cloned &&
+ test_commit -C cloned first &&
+ test_config receive.denyCurrentBranch refuse &&
+ test_must_fail git -C cloned push origin HEAD:new-wt &&
+ test_config receive.denyCurrentBranch updateInstead &&
+ git -C cloned push origin HEAD:new-wt &&
+ test_must_fail git -C cloned push --delete origin new-wt