Merge branch 'jt/t5551-protocol-v2-does-not-have-half-auth'
authorJunio C Hamano <gitster@pobox.com>
Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)
Test update.

* jt/t5551-protocol-v2-does-not-have-half-auth:
t5551: mark half-auth no-op fetch test as v0-only

1  2 
t/t5551-http-fetch-smart.sh
index a685d3edb66d197cef137186f667a7b4123e0f13,2391158b48ac7f58f6ad764ea2aebd78a683c506..c760514716e37868feb1bd6be94b05912999df85
@@@ -43,8 -43,7 +43,8 @@@ test_expect_success 'clone http reposit
        < Cache-Control: no-cache, max-age=0, must-revalidate
        < Content-Type: application/x-git-upload-pack-result
        EOF
 -      GIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
 +      GIT_TRACE_CURL=true GIT_TEST_PROTOCOL_VERSION= \
 +              git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&
        test_cmp file clone/file &&
        tr '\''\015'\'' Q <err |
        sed -e "
                /^< Content-Length: /d
                /^< Transfer-Encoding: /d
        " >actual &&
 -      sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
 -                      actual >actual.smudged &&
 -      test_cmp exp actual.smudged &&
  
 -      grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
 -      test_line_count = 2 actual.gzip
 +      # NEEDSWORK: If the overspecification of the expected result is reduced, we
 +      # might be able to run this test in all protocol versions.
 +      if test -z "$GIT_TEST_PROTOCOL_VERSION"
 +      then
 +              sed -e "s/^> Accept-Encoding: .*/> Accept-Encoding: ENCODINGS/" \
 +                              actual >actual.smudged &&
 +              test_cmp exp actual.smudged &&
 +
 +              grep "Accept-Encoding:.*gzip" actual >actual.gzip &&
 +              test_line_count = 2 actual.gzip
 +      fi
  '
  
  test_expect_success 'fetch changes via http' '
@@@ -110,13 -103,7 +110,13 @@@ test_expect_success 'used upload-pack s
        GET  /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200
        POST /smart/repo.git/git-upload-pack HTTP/1.1 200
        EOF
 -      check_access_log exp
 +
 +      # NEEDSWORK: If the overspecification of the expected result is reduced, we
 +      # might be able to run this test in all protocol versions.
 +      if test -z "$GIT_TEST_PROTOCOL_VERSION"
 +      then
 +              check_access_log exp
 +      fi
  '
  
  test_expect_success 'follow redirects (301)' '
@@@ -164,7 -151,17 +164,17 @@@ test_expect_success 'clone from auth-on
  
  test_expect_success 'no-op half-auth fetch does not require a password' '
        set_askpass wrong &&
-       git --git-dir=half-auth fetch &&
+       # NEEDSWORK: When using HTTP(S), protocol v0 supports a "half-auth"
+       # configuration with authentication required only when downloading
+       # objects and not refs, by having the HTTP server only require
+       # authentication for the "git-upload-pack" path and not "info/refs".
+       # This is not possible with protocol v2, since both objects and refs
+       # are obtained from the "git-upload-pack" path. A solution to this is
+       # to teach the server and client to be able to inline ls-refs requests
+       # as an Extra Parameter (see pack-protocol.txt), so that "info/refs"
+       # can serve refs, just like it does in protocol v0.
+       GIT_TEST_PROTOCOL_VERSION=0 git --git-dir=half-auth fetch &&
        expect_askpass none
  '
  
@@@ -228,14 -225,8 +238,14 @@@ 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 | sort >cookies_tail.txt &&
 -      test_cmp expect_cookies.txt cookies_tail.txt
 +
 +      # NEEDSWORK: If the overspecification of the expected result is reduced, we
 +      # might be able to run this test in all protocol versions.
 +      if test -z "$GIT_TEST_PROTOCOL_VERSION"
 +      then
 +              tail -3 cookies.txt | sort >cookies_tail.txt &&
 +              test_cmp expect_cookies.txt cookies_tail.txt
 +      fi
  '
  
  test_expect_success 'transfer.hiderefs works over smart-http' '
@@@ -325,10 -316,7 +335,10 @@@ test_expect_success 'test allowreachabl
  
        git init --bare test_reachable.git &&
        git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
 -      test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
 +      # Some protocol versions (e.g. 2) support fetching
 +      # unadvertised objects, so restrict this test to v0.
 +      test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
 +              git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"
  '
  
  test_expect_success 'test allowanysha1inwant with unreachable' '
  
        git init --bare test_reachable.git &&
        git -C test_reachable.git remote add origin "$HTTPD_URL/smart/repo.git" &&
 -      test_must_fail git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
 +      # Some protocol versions (e.g. 2) support fetching
 +      # unadvertised objects, so restrict this test to v0.
 +      test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
 +              git -C test_reachable.git fetch origin "$(git rev-parse HEAD)" &&
  
        git -C "$server" config uploadpack.allowanysha1inwant 1 &&
        git -C test_reachable.git fetch origin "$(git rev-parse HEAD)"