X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=t%2Ft5400-send-pack.sh;h=8afb89971752fe4a91b9b7c62b4b0a6b69a8272b;hb=69de8cc8527dc45a7aef76e8f1ace45b509b3712;hp=7fc3bd7d3e9c7761a1c64073be95129d3e93bae8;hpb=b12bbd5986e1fae4120d7a415c1271c0273cad7e;p=git.git diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 7fc3bd7d3..8afb89971 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -43,7 +43,15 @@ test_expect_success setup ' test_expect_success \ 'pushing rewound head should not barf but require --force' ' # should not fail but refuse to update. - git-send-pack ./victim/.git/ master && + if git-send-pack ./victim/.git/ master + then + # now it should fail with Pasky patch + echo >&2 Gaah, it should have failed. + false + else + echo >&2 Thanks, it correctly failed. + true + fi && if cmp victim/.git/refs/heads/master .git/refs/heads/master then # should have been left as it was! @@ -56,4 +64,18 @@ test_expect_success \ cmp victim/.git/refs/heads/master .git/refs/heads/master ' +unset GIT_CONFIG GIT_CONFIG_LOCAL +HOME=`pwd`/no-such-directory +export HOME ;# this way we force the victim/.git/config to be used. + +test_expect_success \ + 'pushing with --force should be denied with denyNonFastforwards' ' + cd victim && + git-repo-config receive.denyNonFastforwards true && + cd .. && + git-update-ref refs/heads/master master^ && + git-send-pack --force ./victim/.git/ master && + ! diff -u .git/refs/heads/master victim/.git/refs/heads/master +' + test_done