Skip to content

Commit 47c95e7

Browse files
avargitster
authored andcommitted
mktag tests: stress test whitespace handling
Add tests for a couple of whitespace edge cases around the header/body boundary. I consider the requirement for a blank line before the empty body a bug, it's a long-standing regression which goes against the command's documented behavior. This bug will be addressed in a follow-up change. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b9e4dd commit 47c95e7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t3800-mktag.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,42 @@ EOF
337337
check_verify_failure 'detect invalid header entry' \
338338
'^error: char.*: trailing garbage in tag header$'
339339

340+
cat >tag.sig <<EOF
341+
object $head
342+
type commit
343+
tag mytag
344+
tagger T A Gger <[email protected]> 1206478233 -0500
345+
346+
347+
this line comes after an extra newline
348+
EOF
349+
350+
test_expect_success 'allow extra newlines at start of body' '
351+
git mktag <tag.sig
352+
'
353+
354+
cat >tag.sig <<EOF
355+
object $head
356+
type commit
357+
tag mytag
358+
tagger T A Gger <[email protected]> 1206478233 -0500
359+
360+
EOF
361+
362+
test_expect_success 'require a blank line before an empty body (1)' '
363+
git mktag <tag.sig
364+
'
365+
366+
cat >tag.sig <<EOF
367+
object $head
368+
type commit
369+
tag mytag
370+
tagger T A Gger <[email protected]> 1206478233 -0500
371+
EOF
372+
373+
check_verify_failure 'require a blank line before an empty body (2)' \
374+
'^error: char.*: trailing garbage in tag header$'
375+
340376
############################################################
341377
# 24. create valid tag
342378

0 commit comments

Comments
 (0)