fsck: add a few committer name tests

fsck reports "missing space before <email>" for committer string equal to "name email>" or to "". It'd be nicer to say "missing email" for the second string and "name is bad" (has > in it) for the first one. Add a failing test for these messages. For "name> <email>" no error is reported. Looks like a bug, so add such a failing test." Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dmitry Ivankov committed Aug 11, 2011 at 16:21 UTC e3c98120f56c191ada76eea45cb213a345682843
1 file changed +36
t/t1450-fsck.sh
+36
@@ -110,6 +110,42 @@ test_expect_success 'email with embedded > is not okay' '
110 grep "error in commit $new" out
111 '
112
113 +test_expect_failure 'missing < email delimiter is reported nicely' '
114 + git cat-file commit HEAD >basis &&
115 + sed "s/<//" basis >bad-email-2 &&
116 + new=$(git hash-object -t commit -w --stdin <bad-email-2) &&
117 + test_when_finished "remove_object $new" &&
118 + git update-ref refs/heads/bogus "$new" &&
119 + test_when_finished "git update-ref -d refs/heads/bogus" &&
120 + git fsck 2>out &&
121 + cat out &&
122 + grep "error in commit $new.* - bad name" out
123 +'
124 +
125 +test_expect_failure 'missing email is reported nicely' '
126 + git cat-file commit HEAD >basis &&
127 + sed "s/[a-z]* <[^>]*>//" basis >bad-email-3 &&
128 + new=$(git hash-object -t commit -w --stdin <bad-email-3) &&
129 + test_when_finished "remove_object $new" &&
130 + git update-ref refs/heads/bogus "$new" &&
131 + test_when_finished "git update-ref -d refs/heads/bogus" &&
132 + git fsck 2>out &&
133 + cat out &&
134 + grep "error in commit $new.* - missing email" out
135 +'
136 +
137 +test_expect_failure '> in name is reported' '
138 + git cat-file commit HEAD >basis &&
139 + sed "s/ </> </" basis >bad-email-4 &&
140 + new=$(git hash-object -t commit -w --stdin <bad-email-4) &&
141 + test_when_finished "remove_object $new" &&
142 + git update-ref refs/heads/bogus "$new" &&
143 + test_when_finished "git update-ref -d refs/heads/bogus" &&
144 + git fsck 2>out &&
145 + cat out &&
146 + grep "error in commit $new" out
147 +'
148 +
149 test_expect_success 'tag pointing to nonexistent' '
150 cat >invalid-tag <<-\EOF &&
151 object ffffffffffffffffffffffffffffffffffffffff