Merge branch 'nd/corrupt-worktrees'
[gitweb.git] / t / t5516-fetch-push.sh
index 4f065212b85c437d1669767bca50795490f8a2c7..c81ca360ac4ac9edccf86132aa63e44812906980 100755 (executable)
@@ -1147,8 +1147,12 @@ test_expect_success 'fetch exact SHA1' '
                git prune &&
                test_must_fail git cat-file -t $the_commit &&
 
+               # Some protocol versions (e.g. 2) support fetching
+               # unadvertised objects, so restrict this test to v0.
+
                # fetching the hidden object should fail by default
-               test_must_fail git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
+               test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+                       git fetch -v ../testrepo $the_commit:refs/heads/copy 2>err &&
                test_i18ngrep "Server does not allow request for unadvertised object" err &&
                test_must_fail git rev-parse --verify refs/heads/copy &&
 
@@ -1204,7 +1208,10 @@ do
                mk_empty shallow &&
                (
                        cd shallow &&
-                       test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 &&
+                       # 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 fetch --depth=1 ../testrepo/.git $SHA1 &&
                        git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
                        git fetch --depth=1 ../testrepo/.git $SHA1 &&
                        git cat-file commit $SHA1
@@ -1232,15 +1239,20 @@ do
                mk_empty shallow &&
                (
                        cd shallow &&
-                       test_must_fail git fetch ../testrepo/.git $SHA1_3 &&
-                       test_must_fail git fetch ../testrepo/.git $SHA1_1 &&
+                       # 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 fetch ../testrepo/.git $SHA1_3 &&
+                       test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+                               git fetch ../testrepo/.git $SHA1_1 &&
                        git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
                        git fetch ../testrepo/.git $SHA1_1 &&
                        git cat-file commit $SHA1_1 &&
                        test_must_fail git cat-file commit $SHA1_2 &&
                        git fetch ../testrepo/.git $SHA1_2 &&
                        git cat-file commit $SHA1_2 &&
-                       test_must_fail git fetch ../testrepo/.git $SHA1_3 2>err &&
+                       test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+                               git fetch ../testrepo/.git $SHA1_3 2>err &&
                        test_i18ngrep "remote error:.*not our ref.*$SHA1_3\$" err
                )
        '
@@ -1382,7 +1394,7 @@ test_expect_success 'push does not follow tags by default' '
        test_cmp expect actual
 '
 
-test_expect_success 'push --follow-tag only pushes relevant tags' '
+test_expect_success 'push --follow-tags only pushes relevant tags' '
        mk_test testrepo heads/master &&
        rm -fr src dst &&
        git init src &&
@@ -1396,7 +1408,7 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
                git tag -m "future" future &&
                git checkout master &&
                git for-each-ref refs/heads/master refs/tags/tag >../expect &&
-               git push --follow-tag ../dst master
+               git push --follow-tags ../dst master
        ) &&
        (
                cd dst &&