fsck: document and test commented & empty line skipList input

There is currently no comment syntax for the fsck.skipList, this isn't really by design, and it would be nice to have support for comments. Document that this doesn't work, and test for how this errors out. These tests reveal a current bug, if there's invalid input the output will emit some of the next line, and then go into uninitialized memory. This is fixed in a subsequent change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 3, 2018 at 14:49 UTC f706c42bab5a2ac4af45e0df7853af1fc5346c45
2 files changed +28 -4
Documentation/config.txt
+7 -4
@@ -1712,10 +1712,13 @@ will only cause git to warn.
1712 fsck.skipList::
1713 The path to a list of object names (i.e. one SHA-1 per
1714 line) that are known to be broken in a non-fatal way and should
1715 - be ignored. This feature is useful when an established project
1716 - should be accepted despite early commits containing errors that
1717 - can be safely ignored such as invalid committer email addresses.
1718 - Note: corrupt objects cannot be skipped with this setting.
1715 + be ignored. Comments ('#') and empty lines are not supported, and
1716 + will error out.
1717 ++
1718 +This feature is useful when an established project should be accepted
1719 +despite early commits containing errors that can be safely ignored
1720 +such as invalid committer email addresses. Note: corrupt objects
1721 +cannot be skipped with this setting.
1722 +
1723 Like `fsck.<msg-id>` this variable has corresponding
1724 `receive.fsck.skipList` and `fetch.fsck.skipList` variants.
t/t5504-fetch-receive-strict.sh
+21
@@ -169,6 +169,27 @@ test_expect_success 'fsck with invalid or bogus skipList input' '
169 test_i18ngrep "Invalid SHA-1: \[core\]" err
170 '
171
172 +test_expect_success 'fsck with invalid or bogus skipList input (comments & empty lines)' '
173 + cat >SKIP.with-comment <<-EOF &&
174 + # Some bad commit
175 + 0000000000000000000000000000000000000001
176 + EOF
177 + test_must_fail git -c fsck.skipList=SKIP.with-comment fsck 2>err-with-comment &&
178 + test_i18ngrep "^fatal: Invalid SHA-1: # Some bad commit$" err-with-comment &&
179 + cat >SKIP.with-empty-line <<-EOF &&
180 + 0000000000000000000000000000000000000001
181 +
182 + 0000000000000000000000000000000000000002
183 + EOF
184 + test_must_fail git -c fsck.skipList=SKIP.with-empty-line fsck 2>err-with-empty-line &&
185 + test_i18ngrep "^fatal: Invalid SHA-1: " err-with-empty-line
186 +'
187 +
188 +test_expect_failure 'fsck no garbage output from comments & empty lines errors' '
189 + test_line_count = 1 err-with-comment &&
190 + test_line_count = 1 err-with-empty-line
191 +'
192 +
193 test_expect_success 'push with receive.fsck.skipList' '
194 git push . $commit:refs/heads/bogus &&
195 rm -rf dst &&