t1450: make sure fsck detects a malformed tagger line

With "hash-object --literally", write a tag object that is not supposed to pass one of the new checks added to "fsck", and make sure that the new check catches the breakage. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 11, 2014 at 14:16 UTC b659605da66ffd513ae60e767495899507e8dfcb
1 file changed +19
t/t1450-fsck.sh
+19
@@ -213,6 +213,25 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
213 grep "expected .tagger. line" out
214 '
215
216 +test_expect_success 'tag with bad tagger' '
217 + sha=$(git rev-parse HEAD) &&
218 + cat >wrong-tag <<-EOF &&
219 + object $sha
220 + type commit
221 + tag not-quite-wrong
222 + tagger Bad Tagger Name
223 +
224 + This is an invalid tag.
225 + EOF
226 +
227 + tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
228 + test_when_finished "remove_object $tag" &&
229 + echo $tag >.git/refs/tags/wrong &&
230 + test_when_finished "git update-ref -d refs/tags/wrong" &&
231 + test_must_fail git fsck --tags 2>out &&
232 + grep "error in tag .*: invalid author/committer" out
233 +'
234 +
235 test_expect_success 'cleaned up' '
236 git fsck >actual 2>&1 &&
237 test_cmp empty actual