summaryrefslogtreecommitdiff
path: root/t/t1450-fsck.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-11 21:16:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-12 18:05:15 (GMT)
commitb659605da66ffd513ae60e767495899507e8dfcb (patch)
treead0cfe67b5de7f3c7b643568569b54d894927ac6 /t/t1450-fsck.sh
parent40e94ca19adf00caa3d19a199b9b0a6079d12a3a (diff)
downloadgit-b659605da66ffd513ae60e767495899507e8dfcb.zip
git-b659605da66ffd513ae60e767495899507e8dfcb.tar.gz
git-b659605da66ffd513ae60e767495899507e8dfcb.tar.bz2
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>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-xt/t1450-fsck.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 1b96b40..b120a2d 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -213,6 +213,25 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
grep "expected .tagger. line" out
'
+test_expect_success 'tag with bad tagger' '
+ sha=$(git rev-parse HEAD) &&
+ cat >wrong-tag <<-EOF &&
+ object $sha
+ type commit
+ tag not-quite-wrong
+ tagger Bad Tagger Name
+
+ This is an invalid tag.
+ EOF
+
+ tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
+ test_when_finished "remove_object $tag" &&
+ echo $tag >.git/refs/tags/wrong &&
+ test_when_finished "git update-ref -d refs/tags/wrong" &&
+ test_must_fail git fsck --tags 2>out &&
+ grep "error in tag .*: invalid author/committer" out
+'
+
test_expect_success 'cleaned up' '
git fsck >actual 2>&1 &&
test_cmp empty actual