push: anonymize URL in status output
[gitweb.git] / t / t5551-http-fetch-smart.sh
index c34e930bb9d6c0c29f4d6dec35476e409fd34961..58207d88250f57d448f4e83baf2add3192cb9455 100755 (executable)
@@ -2,12 +2,6 @@
 
 test_description='test smart fetching over http via http-backend'
 . ./test-lib.sh
-
-if test -n "$NO_CURL"; then
-       skip_all='skipping test, git built without http support'
-       test_done
-fi
-
 . "$TEST_DIRECTORY"/lib-httpd.sh
 start_httpd
 
@@ -83,7 +77,7 @@ test_expect_success 'clone http repository' '
 test_expect_success 'fetch changes via http' '
        echo content >>file &&
        git commit -a -m two &&
-       git push public
+       git push public &&
        (cd clone && git pull) &&
        test_cmp file clone/file
 '
@@ -169,7 +163,7 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' '
 '
 
 test_expect_success 'invalid Content-Type rejected' '
-       test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual
+       test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&
        grep "not valid:" actual
 '
 
@@ -209,10 +203,21 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
        git config http.cookiefile cookies.txt &&
        git config http.savecookies true &&
        git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
-       tail -3 cookies.txt > cookies_tail.txt
+       tail -3 cookies.txt >cookies_tail.txt &&
        test_cmp expect_cookies.txt cookies_tail.txt
 '
 
+test_expect_success 'transfer.hiderefs works over smart-http' '
+       test_commit hidden &&
+       test_commit visible &&
+       git push public HEAD^:refs/heads/a HEAD:refs/heads/b &&
+       git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
+               config transfer.hiderefs refs/heads/a &&
+       git clone --bare "$HTTPD_URL/smart/repo.git" hidden.git &&
+       test_must_fail git -C hidden.git rev-parse --verify a &&
+       git -C hidden.git rev-parse --verify b
+'
+
 # create an arbitrary number of tags, numbered from tag-$1 to tag-$2
 create_tags () {
        rm -f marks &&
@@ -238,20 +243,44 @@ create_tags () {
        sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
 }
 
-test_expect_success 'create 50,000 tags in the repo' '
+test_expect_success 'create 2,000 tags in the repo' '
        (
                cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-               create_tags 1 50000
+               create_tags 1 2000
        )
 '
 
-test_expect_success EXPENSIVE 'clone the 50,000 tag repo to check OS command line overflow' '
-       git clone $HTTPD_URL/smart/repo.git too-many-refs &&
+test_expect_success CMDLINE_LIMIT \
+       'clone the 2,000 tag repo to check OS command line overflow' '
+       run_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&
        (
                cd too-many-refs &&
-               test $(git for-each-ref refs/tags | wc -l) = 50000
+               git for-each-ref refs/tags >actual &&
+               test_line_count = 2000 actual
        )
 '
 
+test_expect_success 'large fetch-pack requests can be split across POSTs' '
+       GIT_CURL_VERBOSE=1 git -c http.postbuffer=65536 \
+               clone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&
+       grep "^> POST" err >posts &&
+       test_line_count = 2 posts
+'
+
+test_expect_success EXPENSIVE 'http can handle enormous ref negotiation' '
+       (
+               cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+               create_tags 2001 50000
+       ) &&
+       git -C too-many-refs fetch -q --tags &&
+       (
+               cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+               create_tags 50001 100000
+       ) &&
+       git -C too-many-refs fetch -q --tags &&
+       git -C too-many-refs for-each-ref refs/tags >tags &&
+       test_line_count = 100000 tags
+'
+
 stop_httpd
 test_done