diff options
author | David Turner <dturner@twosigma.com> | 2016-11-11 12:23:48 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-11-18 13:06:14 -0800 |
commit | f8edeaa05d8623a9f6dad408237496c51101aad8 (patch) | |
tree | faf475f7743ddb59bcde10bb1ba495f426153d45 /t/t5551-http-fetch-smart.sh | |
parent | remote-curl: don't hang when a server dies before any output (diff) | |
download | tgif-f8edeaa05d8623a9f6dad408237496c51101aad8.tar.xz |
upload-pack: optionally allow fetching any sha1
It seems a little silly to do a reachabilty check in the case where we
trust the user to access absolutely everything in the repository.
Also, it's racy in a distributed system -- perhaps one server
advertises a ref, but another has since had a force-push to that ref,
and perhaps the two HTTP requests end up directed to these different
servers.
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch-smart.sh')
-rwxr-xr-x | t/t5551-http-fetch-smart.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh index 43665ab4a8..8d3db405c0 100755 --- a/t/t5551-http-fetch-smart.sh +++ b/t/t5551-http-fetch-smart.sh @@ -306,6 +306,28 @@ test_expect_success 'test allowreachablesha1inwant with unreachable' ' test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" ' +test_expect_success 'test allowanysha1inwant with unreachable' ' + test_when_finished "rm -rf test_reachable.git; git reset --hard $(git rev-parse HEAD)" && + + #create unreachable sha + echo content >file2 && + git add file2 && + git commit -m two && + git push public HEAD:refs/heads/doomed && + git push public :refs/heads/doomed && + + server="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && + master_sha=$(git -C "$server" rev-parse refs/heads/master) && + git -C "$server" config uploadpack.allowreachablesha1inwant 1 && + + git init --bare test_reachable.git && + git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" && + test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" && + + git -C "$server" config uploadpack.allowanysha1inwant 1 && + git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" +' + test_expect_success EXPENSIVE 'http can handle enormous ref negotiation' ' ( cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && |