Skip to content

Commit f706c42

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 58dc440 commit f706c42

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

Documentation/config.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,10 +1712,13 @@ will only cause git to warn.
17121712
fsck.skipList::
17131713
The path to a list of object names (i.e. one SHA-1 per
17141714
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.
17191722
+
17201723
Like `fsck.<msg-id>` this variable has corresponding
17211724
`receive.fsck.skipList` and `fetch.fsck.skipList` variants.

t/t5504-fetch-receive-strict.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,27 @@ test_expect_success 'fsck with invalid or bogus skipList input' '
169169
test_i18ngrep "Invalid SHA-1: \[core\]" err
170170
'
171171

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+
172193
test_expect_success 'push with receive.fsck.skipList' '
173194
git push . $commit:refs/heads/bogus &&
174195
rm -rf dst &&

0 commit comments

Comments
 (0)