summaryrefslogtreecommitdiff
path: root/t/t5551-http-fetch-smart.sh
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-09-27 19:24:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-07 00:53:21 (GMT)
commite70a3030e747312327a4f3619247bf8a986aa577 (patch)
tree595256e117267f0dd72e9e7c75104efc9fd62dd4 /t/t5551-http-fetch-smart.sh
parent6ab4055775b0e560d1f2a1be2e7251d872874655 (diff)
downloadgit-e70a3030e747312327a4f3619247bf8a986aa577.zip
git-e70a3030e747312327a4f3619247bf8a986aa577.tar.gz
git-e70a3030e747312327a4f3619247bf8a986aa577.tar.bz2
fetch: do not list refs if fetching only hashes
If only hash literals are given on a "git fetch" command-line, tag following is not requested, and the fetch is done using protocol v2, a list of refs is not required from the remote. Therefore, optimize by invoking transport_get_remote_refs() only if we need the refs. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5551-http-fetch-smart.sh')
-rwxr-xr-xt/t5551-http-fetch-smart.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 771f36f..12b339d 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 &&