]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/http-backend-deadlock-2.3' into jk/http-backend-deadlock
authorJunio C Hamano <gitster@pobox.com>
Tue, 26 May 2015 03:44:42 +0000 (20:44 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 May 2015 03:44:42 +0000 (20:44 -0700)
* jk/http-backend-deadlock-2.3:
  http-backend: spool ref negotiation requests to buffer
  t5551: factor out tag creation
  http-backend: fix die recursion with custom handler

1  2 
t/t5551-http-fetch-smart.sh

index 66439e58fcf4b08a43ef417b054ae476ffbe3aea,1cca6832904fc237a25c8873675765bfdd2d1506..a540c6da23782c47a08b2e7bc684d68fe8e80934
@@@ -83,7 -83,7 +83,7 @@@ test_expect_success 'clone http reposit
  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 -169,7 +169,7 @@@ test_expect_success 'GIT_SMART_HTTP ca
  '
  
  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,42 -209,39 +209,50 @@@ test_expect_success 'cookies stored in 
        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 'create 2,000 tags in the repo' '
-       (
-       cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
-       for i in $(test_seq 2000)
 +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 &&
+       for i in $(test_seq "$1" "$2")
        do
-               echo "commit refs/heads/too-many-refs"
-               echo "mark :$i"
-               echo "committer git <git@example.com> $i +0000"
-               echo "data 0"
-               echo "M 644 inline bla.txt"
-               echo "data 4"
-               echo "bla"
+               # don't use here-doc, because it requires a process
+               # per loop iteration
+               echo "commit refs/heads/too-many-refs-$1" &&
+               echo "mark :$i" &&
+               echo "committer git <git@example.com> $i +0000" &&
+               echo "data 0" &&
+               echo "M 644 inline bla.txt" &&
+               echo "data 4" &&
+               echo "bla" &&
                # make every commit dangling by always
                # rewinding the branch after each commit
-               echo "reset refs/heads/too-many-refs"
-               echo "from :1"
+               echo "reset refs/heads/too-many-refs-$1" &&
+               echo "from :$1"
        done | git fast-import --export-marks=marks &&
  
        # now assign tags to all the dangling commits we created above
        tag=$(perl -e "print \"bla\" x 30") &&
        sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
+ }
+ test_expect_success 'create 2,000 tags in the repo' '
+       (
+               cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
+               create_tags 1 2000
        )
  '
  
@@@ -265,5 -262,20 +273,20 @@@ test_expect_success 'large fetch-pack r
        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