Merge branch 'jk/p5302-avoid-collision-check-cost'
[gitweb.git] / t / t5702-protocol-v2.sh
index 9b048f6c8bc82852f52bf03baf33f174d99f23b7..5b33f625dddeccce7ecd68b45f115a46f7fbe93a 100755 (executable)
@@ -400,12 +400,13 @@ test_expect_success 'even with handcrafted request, filter does not work if not
        0000
        EOF
 
-       test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
+       test_must_fail test-tool -C server serve-v2 --stateless-rpc \
+               <in >/dev/null 2>err &&
        grep "unexpected line: .filter blob:none." err &&
 
        # Exercise to ensure that if advertised, filter works
        git -C server config uploadpack.allowfilter 1 &&
-       git -C server serve --stateless-rpc <in >/dev/null
+       test-tool -C server serve-v2 --stateless-rpc <in >/dev/null
 '
 
 test_expect_success 'default refspec is used to filter ref when fetchcing' '
@@ -583,7 +584,38 @@ test_expect_success 'clone with http:// using protocol v2' '
        # Client requested to use protocol v2
        grep "Git-Protocol: version=2" log &&
        # Server responded using protocol v2
-       grep "git< version 2" log
+       grep "git< version 2" log &&
+       # Verify that the chunked encoding sending codepath is NOT exercised
+       ! grep "Send header: Transfer-Encoding: chunked" log
+'
+
+test_expect_success 'clone big repository with http:// using protocol v2' '
+       test_when_finished "rm -f log" &&
+
+       git init "$HTTPD_DOCUMENT_ROOT_PATH/big" &&
+       # Ensure that the list of wants is greater than http.postbuffer below
+       for i in $(test_seq 1 1500)
+       do
+               # do not use here-doc, because it requires a process
+               # per loop iteration
+               echo "commit refs/heads/too-many-refs-$i" &&
+               echo "committer git <git@example.com> $i +0000" &&
+               echo "data 0" &&
+               echo "M 644 inline bla.txt" &&
+               echo "data 4" &&
+               echo "bla"
+       done | git -C "$HTTPD_DOCUMENT_ROOT_PATH/big" fast-import &&
+
+       GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" git \
+               -c protocol.version=2 -c http.postbuffer=65536 \
+               clone "$HTTPD_URL/smart/big" big_child &&
+
+       # Client requested to use protocol v2
+       grep "Git-Protocol: version=2" log &&
+       # Server responded using protocol v2
+       grep "git< version 2" log &&
+       # Verify that the chunked encoding sending codepath is exercised
+       grep "Send header: Transfer-Encoding: chunked" log
 '
 
 test_expect_success 'fetch with http:// using protocol v2' '
@@ -697,6 +729,4 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
        test_i18ngrep "expected no other sections to be sent after no .ready." err
 '
 
-stop_httpd
-
 test_done