aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-09-23 10:32:59 -0700
committerJunio C Hamano <gitster@pobox.com>2024-09-23 10:33:00 -0700
commit1c8d664dfd099375e015b28b633b6caa99f00883 (patch)
tree1cacbfca1b2b9fedf02d2f445f0cb5edbfa5d84e /t
parentMerge branch 'rj/cygwin-has-dev-tty' into maint-2.46 (diff)
parentinterpret-trailers: handle message without trailing newline (diff)
downloadgit-1c8d664dfd099375e015b28b633b6caa99f00883.tar.gz
git-1c8d664dfd099375e015b28b633b6caa99f00883.zip
Merge branch 'bl/trailers-and-incomplete-last-line-fix' into maint-2.46
The interpret-trailers command failed to recognise the end of the message when the commit log ends in an incomplete line. * bl/trailers-and-incomplete-last-line-fix: interpret-trailers: handle message without trailing newline
Diffstat (limited to 't')
-rwxr-xr-xt/t7513-interpret-trailers.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index 3d3e13ccf8..0f7d8938d9 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -175,6 +175,46 @@ test_expect_success 'with only a title in the message' '
test_cmp expected actual
'
+test_expect_success 'with a bodiless message that lacks a trailing newline after the subject' '
+ cat >expected <<-\EOF &&
+ area: change
+
+ Reviewed-by: Peff
+ Acked-by: Johan
+ EOF
+ printf "area: change" |
+ git interpret-trailers --trailer "Reviewed-by: Peff" \
+ --trailer "Acked-by: Johan" >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'with a bodied message that lacks a trailing newline after the body' '
+ cat >expected <<-\EOF &&
+ area: change
+
+ details about the change.
+
+ Reviewed-by: Peff
+ Acked-by: Johan
+ EOF
+ printf "area: change\n\ndetails about the change." |
+ git interpret-trailers --trailer "Reviewed-by: Peff" \
+ --trailer "Acked-by: Johan" >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'with a message that lacks a trailing newline after the trailers' '
+ cat >expected <<-\EOF &&
+ area: change
+
+ Reviewed-by: Peff
+ Acked-by: Johan
+ EOF
+ printf "area: change\n\nReviewed-by: Peff" |
+ git interpret-trailers --trailer "Acked-by: Johan" >actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'with multiline title in the message' '
cat >expected <<-\EOF &&
place of