@ -538,9 +538,23 @@ test_expect_success 'with 2 files arguments' '
@@ -538,9 +538,23 @@ test_expect_success 'with 2 files arguments' '
test_cmp expected actual
'
test_expect_success 'with message that has comments' '
# Cover multiple comment characters with the same test input.
for char in "#" ";"
do
case "$char" in
"#")
# This is the default, so let's explicitly _not_
# set any config to make sure it behaves as we expect.
;;
*)
config="-c core.commentChar=$char"
;;
esac
test_expect_success "with message that has comments ($char)" '
cat basic_message >message_with_comments &&
sed -e "s/ Z\$/ /" >>message_with_comments <<-\EOF &&
sed -e "s/ Z\$/ /" \
-e "s/#/$char/g" >>message_with_comments <<-EOF &&
# comment
# other comment
@ -553,7 +567,7 @@ test_expect_success 'with message that has comments' '
@@ -553,7 +567,7 @@ test_expect_success 'with message that has comments' '
EOF
cat basic_patch >>message_with_comments &&
cat basic_message >expected &&
cat >>expected <<-\EOF &&
sed -e "s/#/$char/g" >>expected <<-\EOF &&
# comment
Reviewed-by: Johan
@ -562,9 +576,12 @@ test_expect_success 'with message that has comments' '
@@ -562,9 +576,12 @@ test_expect_success 'with message that has comments' '
EOF
cat basic_patch >>expected &&
git interpret-trailers --trim-empty --trailer "Cc: Peff" message_with_comments >actual &&
git $config interpret-trailers \
--trim-empty --trailer "Cc: Peff" \
message_with_comments >actual &&
test_cmp expected actual
'
'
done
test_expect_success 'with message that has an old style conflict block' '
cat basic_message >message_with_comments &&