tests: add a special setup where prerequisites fail
[gitweb.git] / t / t5516-fetch-push.sh
index 49bf4280e85cae7da71b54192ab83879931283bd..c81ca360ac4ac9edccf86132aa63e44812906980 100755 (executable)
@@ -1241,9 +1241,9 @@ do
                        cd shallow &&
                        # Some protocol versions (e.g. 2) support fetching
                        # unadvertised objects, so restrict this test to v0.
-                       test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
+                       test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
                                git fetch ../testrepo/.git $SHA1_3 &&
-                       test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
+                       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 &&
@@ -1251,8 +1251,9 @@ do
                        test_must_fail git cat-file commit $SHA1_2 &&
                        git fetch ../testrepo/.git $SHA1_2 &&
                        git cat-file commit $SHA1_2 &&
-                       test_must_fail ok=sigpipe env GIT_TEST_PROTOCOL_VERSION= \
-                               git fetch ../testrepo/.git $SHA1_3
+                       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
                )
        '
 done
@@ -1284,6 +1285,17 @@ test_expect_success 'fetch follows tags by default' '
        test_cmp expect actual
 '
 
+test_expect_success 'peeled advertisements are not considered ref tips' '
+       mk_empty testrepo &&
+       git -C testrepo commit --allow-empty -m one &&
+       git -C testrepo commit --allow-empty -m two &&
+       git -C testrepo tag -m foo mytag HEAD^ &&
+       oid=$(git -C testrepo rev-parse mytag^{commit}) &&
+       test_must_fail env GIT_TEST_PROTOCOL_VERSION= \
+               git fetch testrepo $oid 2>err &&
+       test_i18ngrep "Server does not allow request for unadvertised object" err
+'
+
 test_expect_success 'pushing a specific ref applies remote.$name.push as refmap' '
        mk_test testrepo heads/master &&
        rm -fr src dst &&