@@ -44,6 +44,8 @@ cat >tag.sig <<EOF
4444xxxxxx 139e9b33986b1c2670fff52c5067603117b3e895
4545type tag
4646tag mytag
47+ tagger . <> 0 +0000
48+
4749EOF
4850
4951check_verify_failure ' "object" line label check' ' ^error: char0: .*"object "$'
@@ -55,6 +57,8 @@ cat >tag.sig <<EOF
5557object zz9e9b33986b1c2670fff52c5067603117b3e895
5658type tag
5759tag mytag
60+ tagger . <> 0 +0000
61+
5862EOF
5963
6064check_verify_failure ' "object" line SHA1 check' ' ^error: char7: .*SHA1 hash$'
@@ -66,6 +70,8 @@ cat >tag.sig <<EOF
6670object 779e9b33986b1c2670fff52c5067603117b3e895
6771xxxx tag
6872tag mytag
73+ tagger . <> 0 +0000
74+
6975EOF
7076
7177check_verify_failure ' "type" line label check' ' ^error: char47: .*"\\ntype "$'
@@ -85,6 +91,8 @@ cat >tag.sig <<EOF
8591object 779e9b33986b1c2670fff52c5067603117b3e895
8692type tag
8793xxx mytag
94+ tagger . <> 0 +0000
95+
8896EOF
8997
9098check_verify_failure ' "tag" line label check #1' \
@@ -121,6 +129,8 @@ cat >tag.sig <<EOF
121129object 779e9b33986b1c2670fff52c5067603117b3e895
122130type tagggg
123131tag mytag
132+ tagger . <> 0 +0000
133+
124134EOF
125135
126136check_verify_failure ' verify object (SHA1/type) check' \
@@ -133,6 +143,8 @@ cat >tag.sig <<EOF
133143object $head
134144type commit
135145tag my tag
146+ tagger . <> 0 +0000
147+
136148EOF
137149
138150check_verify_failure ' verify tag-name check' \
@@ -145,10 +157,12 @@ cat >tag.sig <<EOF
145157object $head
146158type commit
147159tag mytag
160+
161+ This is filler
148162EOF
149163
150164check_verify_failure ' "tagger" line label check #1' \
151- ' ^error: char70: could not find "tagger"$'
165+ ' ^error: char70: could not find "tagger "$'
152166
153167# ###########################################################
154168# 12. tagger line label check #2
@@ -158,27 +172,188 @@ object $head
158172type commit
159173tag mytag
160174tagger
175+
176+ This is filler
161177EOF
162178
163179check_verify_failure ' "tagger" line label check #2' \
164- ' ^error: char70: could not find "tagger"$'
180+ ' ^error: char70: could not find "tagger "$'
165181
166182# ###########################################################
167- # 13. create valid tag
183+ # 13. disallow missing tag author name
168184
169185cat > tag.sig << EOF
170186object $head
171187type commit
172188tag mytag
173- tagger another@example.com
189+ tagger <> 0 +0000
190+
191+ This is filler
192+ EOF
193+
194+ check_verify_failure ' disallow missing tag author name' \
195+ ' ^error: char77: missing tagger name$'
196+
197+ # ###########################################################
198+ # 14. disallow missing tag author name
199+
200+ cat > tag.sig << EOF
201+ object $head
202+ type commit
203+ tag mytag
204+ tagger T A Gger <
205+ > 0 +0000
206+
207+ EOF
208+
209+ check_verify_failure ' disallow malformed tagger' \
210+ ' ^error: char77: malformed tagger field$'
211+
212+ # ###########################################################
213+ # 15. allow empty tag email
214+
215+ cat > tag.sig << EOF
216+ object $head
217+ type commit
218+ tag mytag
219+ tagger T A Gger <> 0 +0000
220+
221+ EOF
222+
223+ test_expect_success \
224+ ' allow empty tag email' \
225+ ' git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
226+
227+ # ###########################################################
228+ # 16. disallow spaces in tag email
229+
230+ cat > tag.sig << EOF
231+ object $head
232+ type commit
233+ tag mytag
234+ tagger T A Gger <tag ger@example.com> 0 +0000
235+
236+ EOF
237+
238+ check_verify_failure ' disallow spaces in tag email' \
239+ ' ^error: char77: malformed tagger field$'
240+
241+ # ###########################################################
242+ # 17. disallow missing tag timestamp
243+
244+ cat > tag.sig << EOF
245+ object $head
246+ type commit
247+ tag mytag
248+ tagger T A Gger <tagger@example.com>
249+
250+ EOF
251+
252+ check_verify_failure ' disallow missing tag timestamp' \
253+ ' ^error: char107: missing tag timestamp$'
254+
255+ # ###########################################################
256+ # 18. detect invalid tag timestamp1
257+
258+ cat > tag.sig << EOF
259+ object $head
260+ type commit
261+ tag mytag
262+ tagger T A Gger <tagger@example.com> Tue Mar 25 15:47:44 2008
263+
264+ EOF
265+
266+ check_verify_failure ' detect invalid tag timestamp1' \
267+ ' ^error: char107: missing tag timestamp$'
268+
269+ # ###########################################################
270+ # 19. detect invalid tag timestamp2
271+
272+ cat > tag.sig << EOF
273+ object $head
274+ type commit
275+ tag mytag
276+ tagger T A Gger <tagger@example.com> 2008-03-31T12:20:15-0500
277+
278+ EOF
279+
280+ check_verify_failure ' detect invalid tag timestamp2' \
281+ ' ^error: char111: malformed tag timestamp$'
282+
283+ # ###########################################################
284+ # 20. detect invalid tag timezone1
285+
286+ cat > tag.sig << EOF
287+ object $head
288+ type commit
289+ tag mytag
290+ tagger T A Gger <tagger@example.com> 1206478233 GMT
291+
292+ EOF
293+
294+ check_verify_failure ' detect invalid tag timezone1' \
295+ ' ^error: char118: malformed tag timezone$'
296+
297+ # ###########################################################
298+ # 21. detect invalid tag timezone2
299+
300+ cat > tag.sig << EOF
301+ object $head
302+ type commit
303+ tag mytag
304+ tagger T A Gger <tagger@example.com> 1206478233 + 30
305+
306+ EOF
307+
308+ check_verify_failure ' detect invalid tag timezone2' \
309+ ' ^error: char118: malformed tag timezone$'
310+
311+ # ###########################################################
312+ # 22. detect invalid tag timezone3
313+
314+ cat > tag.sig << EOF
315+ object $head
316+ type commit
317+ tag mytag
318+ tagger T A Gger <tagger@example.com> 1206478233 -1430
319+
320+ EOF
321+
322+ check_verify_failure ' detect invalid tag timezone3' \
323+ ' ^error: char118: malformed tag timezone$'
324+
325+ # ###########################################################
326+ # 23. detect invalid header entry
327+
328+ cat > tag.sig << EOF
329+ object $head
330+ type commit
331+ tag mytag
332+ tagger T A Gger <tagger@example.com> 1206478233 -0500
333+ this line should not be here
334+
335+ EOF
336+
337+ check_verify_failure ' detect invalid header entry' \
338+ ' ^error: char124: trailing garbage in tag header$'
339+
340+ # ###########################################################
341+ # 24. create valid tag
342+
343+ cat > tag.sig << EOF
344+ object $head
345+ type commit
346+ tag mytag
347+ tagger T A Gger <tagger@example.com> 1206478233 -0500
348+
174349EOF
175350
176351test_expect_success \
177352 ' create valid tag' \
178353 ' git-mktag <tag.sig >.git/refs/tags/mytag 2>message'
179354
180355# ###########################################################
181- # 14 . check mytag
356+ # 25 . check mytag
182357
183358test_expect_success \
184359 ' check mytag' \
0 commit comments