fsck: test and document unknown fsck.<msg-id> values

When fsck.<msg-id> is set to an unknown value it'll cause "fsck" to die, but the same is not true of the "fetch" and "receive" variants. Document this and test for it. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jul 27, 2018 at 14:37 UTC 8a6d0525b74fe07bde0436e4cbf87b23adf7df0a
2 files changed +18
Documentation/config.txt
+4
@@ -1637,6 +1637,10 @@ In general, it is better to enumerate existing objects with problems
1637 with `fsck.skipList`, instead of listing the kind of breakages these
1638 problematic objects share to be ignored, as doing the latter will
1639 allow new instances of the same breakages go unnoticed.
1640 ++
1641 +Setting an unknown `fsck.<msg-id>` value will cause fsck to die, but
1642 +doing the same for `receive.fsck.<msg-id>` and `fetch.fsck.<msg-id>`
1643 +will only cause git to warn.
1644
1645 fsck.skipList::
1646 The path to a sorted list of object names (i.e. one SHA-1 per
t/t5504-fetch-receive-strict.sh
+14
@@ -198,6 +198,10 @@ test_expect_success 'fetch with fetch.fsck.skipList' '
198 git --git-dir=dst/.git fetch "file://$(pwd)" $refspec
199 '
200
201 +test_expect_success 'fsck.<unknownmsg-id> dies' '
202 + test_must_fail git -c fsck.whatEver=ignore fsck 2>err &&
203 + test_i18ngrep "Unhandled message id: whatever" err
204 +'
205
206 test_expect_success 'push with receive.fsck.missingEmail=warn' '
207 commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
@@ -211,10 +215,15 @@ test_expect_success 'push with receive.fsck.missingEmail=warn' '
215 git --git-dir=dst/.git config fsck.missingEmail warn &&
216 test_must_fail git push --porcelain dst bogus &&
217
218 + # receive.fsck.<unknownmsg-id> warns
219 + git --git-dir=dst/.git config \
220 + receive.fsck.whatEver error &&
221 +
222 git --git-dir=dst/.git config \
223 receive.fsck.missingEmail warn &&
224 git push --porcelain dst bogus >act 2>&1 &&
225 grep "missingEmail" act &&
226 + test_i18ngrep "Skipping unknown msg id.*whatever" act &&
227 git --git-dir=dst/.git branch -D bogus &&
228 git --git-dir=dst/.git config --add \
229 receive.fsck.missingEmail ignore &&
@@ -235,10 +244,15 @@ test_expect_success 'fetch with fetch.fsck.missingEmail=warn' '
244 git --git-dir=dst/.git config fsck.missingEmail warn &&
245 test_must_fail git --git-dir=dst/.git fetch "file://$(pwd)" $refspec &&
246
247 + # receive.fsck.<unknownmsg-id> warns
248 + git --git-dir=dst/.git config \
249 + fetch.fsck.whatEver error &&
250 +
251 git --git-dir=dst/.git config \
252 fetch.fsck.missingEmail warn &&
253 git --git-dir=dst/.git fetch "file://$(pwd)" $refspec >act 2>&1 &&
254 grep "missingEmail" act &&
255 + test_i18ngrep "Skipping unknown msg id.*whatever" act &&
256 rm -rf dst &&
257 git init dst &&
258 git --git-dir=dst/.git config fetch.fsckobjects true &&