diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-10-19 04:34:07 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-19 04:34:07 (GMT) |
commit | 0527fbab689929de47ab3fa7baf1e7618ffa704f (patch) | |
tree | 225a1b7916ff4b81f30d661f0014f973eea38642 /t | |
parent | d4cd2dd214c9800c8ccf45cf413acc727f4abcc2 (diff) | |
parent | e70a3030e747312327a4f3619247bf8a986aa577 (diff) | |
download | git-0527fbab689929de47ab3fa7baf1e7618ffa704f.zip git-0527fbab689929de47ab3fa7baf1e7618ffa704f.tar.gz git-0527fbab689929de47ab3fa7baf1e7618ffa704f.tar.bz2 |
Merge branch 'jt/avoid-ls-refs'
Over some transports, fetching objects with an exact commit object
name can be done without first seeing the ref advertisements. The
code has been optimized to exploit this.
* jt/avoid-ls-refs:
fetch: do not list refs if fetching only hashes
transport: list refs before fetch if necessary
transport: do not list refs if possible
transport: allow skipping of ref listing
Diffstat (limited to 't')
-rwxr-xr-x | t/t5551-http-fetch-smart.sh | 15 | ||||
-rwxr-xr-x | t/t5702-protocol-v2.sh | 17 |
2 files changed, 32 insertions, 0 deletions
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh index 3dc8f8e..8630b0c 100755 --- a/t/t5551-http-fetch-smart.sh +++ b/t/t5551-http-fetch-smart.sh @@ -381,6 +381,21 @@ test_expect_success 'using fetch command in remote-curl updates refs' ' test_cmp expect actual ' +test_expect_success 'fetch by SHA-1 without tag following' ' + SERVER="$HTTPD_DOCUMENT_ROOT_PATH/server" && + rm -rf "$SERVER" client && + + git init "$SERVER" && + test_commit -C "$SERVER" foo && + + git clone $HTTPD_URL/smart/server client && + + test_commit -C "$SERVER" bar && + git -C "$SERVER" rev-parse bar >bar_hash && + git -C client -c protocol.version=0 fetch \ + --no-tags origin $(cat bar_hash) +' + test_expect_success 'GIT_REDACT_COOKIES redacts cookies' ' rm -rf clone && echo "Set-Cookie: Foo=1" >cookies && diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 98fbf39..8360188 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -79,6 +79,19 @@ test_expect_success 'fetch with git:// using protocol v2' ' grep "fetch< version 2" log ' +test_expect_success 'fetch by hash without tag following with protocol v2 does not list refs' ' + test_when_finished "rm -f log" && + + test_commit -C "$daemon_parent" two_a && + git -C "$daemon_parent" rev-parse two_a >two_a_hash && + + GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \ + fetch --no-tags origin $(cat two_a_hash) && + + grep "fetch< version 2" log && + ! grep "fetch> command=ls-refs" log +' + test_expect_success 'pull with git:// using protocol v2' ' test_when_finished "rm -f log" && @@ -286,6 +299,10 @@ test_expect_success 'dynamically fetch missing object' ' grep "version 2" trace ' +test_expect_success 'when dynamically fetching missing object, do not list refs' ' + ! grep "git> command=ls-refs" trace +' + test_expect_success 'partial fetch' ' rm -rf client "$(pwd)/trace" && git init client && |