submodule-config.c: use repo_get_oid for reading .gitmodules
[gitweb.git] / t / t5702-protocol-v2.sh
index 7ca1aab6b58bf405cfaf585ddd06d8b02393fe24..e112b6086c96e4cb0ad7bc10dcd685e7570d496f 100755 (executable)
@@ -542,7 +542,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' '
@@ -561,6 +592,27 @@ test_expect_success 'fetch with http:// using protocol v2' '
        grep "git< version 2" log
 '
 
+test_expect_success 'fetch from namespaced repo respects namespaces' '
+       test_when_finished "rm -f log" &&
+
+       git init "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" &&
+       test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" one &&
+       test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" two &&
+       git -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" \
+               update-ref refs/namespaces/ns/refs/heads/master one &&
+
+       GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \
+               fetch "$HTTPD_URL/smart_namespace/nsrepo" \
+               refs/heads/master:refs/heads/theirs &&
+
+       # Server responded using protocol v2
+       grep "fetch< version 2" log &&
+
+       git -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" rev-parse one >expect &&
+       git -C http_child rev-parse theirs >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'push with http:// and a config of v2 does not request v2' '
        test_when_finished "rm -f log" &&
        # Till v2 for push is designed, make sure that if a client has