send-email: clarify missing subject error

Clarify that a message file is missing a 'Subject:' line.

Terminate the error with a newline so Perl does not append its internal
source location.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Harald Nordgren authored and Junio C Hamano committed 2026-08-10 14:07:02 -07:00
1 parent 010afd3166
commit b0b304c10a
2 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -863,7 +863,7 @@ sub get_patch_subject {
return "GIT: $1\n";
}
close $fh;
die sprintf(__("No subject line in %s?"), $fn);
die sprintf(__("No 'Subject:' line in '%s'\n"), $fn);
}
if ($compose) {
+15
View File
@@ -1422,6 +1422,21 @@ test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
test_grep disambiguate errors
'
test_expect_success $PREREQ 'missing subject omits Perl location' '
cat >no-subject.patch <<-\EOF &&
This is the body.
EOF
test_must_fail git send-email \
--dry-run \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
no-subject.patch 2>actual &&
cat >expect <<-\EOF &&
No '\''Subject:'\'' line in '\''no-subject.patch'\''
EOF
test_cmp expect actual
'
test_expect_success $PREREQ 'feed two files' '
rm -fr outdir &&
git format-patch -2 -o outdir &&