Merge branch 'hn/send-email-missing-subject-error'

The error message given by 'git send-email' when a message file is
missing a 'Subject:' header has been clarified, and the error string
is now terminated with a newline so that Perl avoids appending its
internal source location data.

* hn/send-email-missing-subject-error:
  send-email: clarify missing subject error
main
Junio C Hamano 2026-08-23 18:01:44 -07:00
commit 6aab7b26a6
2 changed files with 16 additions and 1 deletions

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) {

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 &&