fetch: implement fetch.fsck.*
[gitweb.git] / t / t5504-fetch-receive-strict.sh
index 57ff78c2010d20160bb0db0ff84d040954041a87..004bfebe983928547d7944dd0343840b358ab79b 100755 (executable)
@@ -145,6 +145,20 @@ test_expect_success 'push with receive.fsck.skipList' '
        git push --porcelain dst bogus
 '
 
+test_expect_success 'fetch with fetch.fsck.skipList' '
+       commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
+       refspec=refs/heads/bogus:refs/heads/bogus &&
+       git push . $commit:refs/heads/bogus &&
+       rm -rf dst &&
+       git init dst &&
+       git --git-dir=dst/.git config fetch.fsckObjects true &&
+       test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec &&
+       git --git-dir=dst/.git config fetch.fsck.skipList dst/.git/SKIP &&
+       echo $commit >dst/.git/SKIP &&
+       git --git-dir=dst/.git fetch "file://$(pwd)" $refspec
+'
+
+
 test_expect_success 'push with receive.fsck.missingEmail=warn' '
        commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
        git push . $commit:refs/heads/bogus &&
@@ -163,6 +177,27 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
        ! grep "missingEmail" act
 '
 
+test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
+       commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
+       refspec=refs/heads/bogus:refs/heads/bogus &&
+       git push . $commit:refs/heads/bogus &&
+       rm -rf dst &&
+       git init dst &&
+       git --git-dir=dst/.git config fetch.fsckobjects true &&
+       test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec &&
+       git --git-dir=dst/.git config \
+               fetch.fsck.missingEmail warn &&
+       git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
+       grep "missingEmail" act &&
+       rm -rf dst &&
+       git init dst &&
+       git --git-dir=dst/.git config fetch.fsckobjects true &&
+       git --git-dir=dst/.git config \
+               fetch.fsck.missingEmail ignore &&
+       git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
+       ! grep "missingEmail" act
+'
+
 test_expect_success \
        'receive.fsck.unterminatedHeader=warn triggers error' '
        rm -rf dst &&
@@ -174,4 +209,15 @@ test_expect_success \
        grep "Cannot demote unterminatedheader" act
 '
 
+test_expect_success \
+       'fetch.fsck.unterminatedHeader=warn triggers error' '
+       rm -rf dst &&
+       git init dst &&
+       git --git-dir=dst/.git config fetch.fsckobjects true &&
+       git --git-dir=dst/.git config \
+               fetch.fsck.unterminatedheader warn &&
+       test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" HEAD &&
+       grep "Cannot demote unterminatedheader" act
+'
+
 test_done