summaryrefslogtreecommitdiffstats
path: root/t/t5550-http-fetch-dumb.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5550-http-fetch-dumb.sh')
-rwxr-xr-xt/t5550-http-fetch-dumb.sh33
1 files changed, 28 insertions, 5 deletions
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 58189c9f7d..21795a19bf 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -4,7 +4,6 @@ test_description='test dumb fetching over http via static file'
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
-TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq !REFFILES
@@ -307,6 +306,14 @@ test_expect_success 'fetch notices corrupt idx' '
)
'
+# usage: count_fetches <nr> <extension> <trace_file>
+count_fetches () {
+ # ignore grep exit code; it may return non-zero if we are expecting no
+ # matches
+ grep "GET .*objects/pack/pack-[a-z0-9]*.$2" "$3" >trace.count
+ test_line_count = "$1" trace.count
+}
+
test_expect_success 'fetch can handle previously-fetched .idx files' '
git checkout --orphan branch1 &&
echo base >file &&
@@ -321,8 +328,14 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
git push "$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git branch2 &&
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH"/repo_packed_branches.git repack -d &&
git --bare init clone_packed_branches.git &&
- git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
- git --git-dir=clone_packed_branches.git fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2
+ GIT_TRACE_CURL=$PWD/one.trace git --git-dir=clone_packed_branches.git \
+ fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch1:branch1 &&
+ count_fetches 2 idx one.trace &&
+ count_fetches 1 pack one.trace &&
+ GIT_TRACE_CURL=$PWD/two.trace git --git-dir=clone_packed_branches.git \
+ fetch "$HTTPD_URL"/dumb/repo_packed_branches.git branch2:branch2 &&
+ count_fetches 1 idx two.trace &&
+ count_fetches 1 pack two.trace
'
test_expect_success 'did not use upload-pack service' '
@@ -344,12 +357,12 @@ test_expect_success 'git client shows text/plain with a charset' '
grep "this is the error message" stderr
'
-test_expect_success 'http error messages are reencoded' '
+test_expect_success ICONV 'http error messages are reencoded' '
test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
grep "this is the error message" stderr
'
-test_expect_success 'reencoding is robust to whitespace oddities' '
+test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
grep "this is the error message" stderr
'
@@ -507,4 +520,14 @@ test_expect_success 'fetching via http alternates works' '
git -c http.followredirects=true clone "$HTTPD_URL/dumb/alt-child.git"
'
+test_expect_success 'dumb http can fetch index v1' '
+ server=$HTTPD_DOCUMENT_ROOT_PATH/idx-v1.git &&
+ git init --bare "$server" &&
+ git -C "$server" --work-tree=. commit --allow-empty -m foo &&
+ git -C "$server" -c pack.indexVersion=1 gc &&
+
+ git clone "$HTTPD_URL/dumb/idx-v1.git" &&
+ git -C idx-v1 fsck
+'
+
test_done