Merge branch 'jc/receive-deny-current-branch-fix' into maint

The receive.denyCurrentBranch=updateInstead codepath kicked in even
when the push should have been rejected due to other reasons, such
as it does not fast-forward or the update-hook rejects it, which
has been corrected.

* jc/receive-deny-current-branch-fix:
  receive: denyCurrentBranch=updateinstead should not blindly update
This commit is contained in:
Junio C Hamano
2018-11-21 22:57:51 +09:00
2 changed files with 16 additions and 4 deletions

View File

@ -1552,7 +1552,13 @@ test_expect_success 'receive.denyCurrentBranch = updateInstead' '
test $(git -C .. rev-parse master) = $(git rev-parse HEAD) &&
git diff --quiet &&
git diff --cached --quiet
)
) &&
# (6) updateInstead intervened by fast-forward check
test_must_fail git push void master^:master &&
test $(git -C void rev-parse HEAD) = $(git rev-parse master) &&
git -C void diff --quiet &&
git -C void diff --cached --quiet
'
test_expect_success 'updateInstead with push-to-checkout hook' '