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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Jan 5, 2021 at 20:42 UTC
47c95e77d158e4660dab25b9fdd6f4d70013b430
1 file changed
+36
t/t3800-mktag.sh
+36
@@ -337,6 +337,42 @@ EOF
337
check_verify_failure 'detect invalid header entry' \
338
'^error: char.*: trailing garbage in tag header$'
339
340
+cat >tag.sig <<EOF
341
+object $head
342
+type commit
343
+tag mytag
344
+tagger T A Gger <tagger@example.com> 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 <tagger@example.com> 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 <tagger@example.com> 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
+
376
############################################################
377
# 24. create valid tag
378