summaryrefslogtreecommitdiff
path: root/t/t3800-mktag.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-01-05 19:42:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-05 22:58:29 (GMT)
commit47c95e77d158e4660dab25b9fdd6f4d70013b430 (patch)
tree5b81f0d8daec3b1bfedd40f8a5b1af74863cd581 /t/t3800-mktag.sh
parent3b9e4dd3a3be6d39bece6a9272640be3b5a817d2 (diff)
downloadgit-47c95e77d158e4660dab25b9fdd6f4d70013b430.zip
git-47c95e77d158e4660dab25b9fdd6f4d70013b430.tar.gz
git-47c95e77d158e4660dab25b9fdd6f4d70013b430.tar.bz2
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>
Diffstat (limited to 't/t3800-mktag.sh')
-rwxr-xr-xt/t3800-mktag.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index 048000c..661b62f 100755
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
@@ -337,6 +337,42 @@ EOF
check_verify_failure 'detect invalid header entry' \
'^error: char.*: trailing garbage in tag header$'
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+tagger T A Gger <tagger@example.com> 1206478233 -0500
+
+
+this line comes after an extra newline
+EOF
+
+test_expect_success 'allow extra newlines at start of body' '
+ git mktag <tag.sig
+'
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+tagger T A Gger <tagger@example.com> 1206478233 -0500
+
+EOF
+
+test_expect_success 'require a blank line before an empty body (1)' '
+ git mktag <tag.sig
+'
+
+cat >tag.sig <<EOF
+object $head
+type commit
+tag mytag
+tagger T A Gger <tagger@example.com> 1206478233 -0500
+EOF
+
+check_verify_failure 'require a blank line before an empty body (2)' \
+ '^error: char.*: trailing garbage in tag header$'
+
############################################################
# 24. create valid tag