From b0b304c10a65882a8e36abbb694603648a78edfd Mon Sep 17 00:00:00 2001 From: Harald Nordgren Date: Mon, 10 Aug 2026 17:53:32 +0000 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- git-send-email.perl | 2 +- t/t9001-send-email.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index bb8ddd1eef..2071cff6ae 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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) { diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index e9d814a34a..d1393ef197 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -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 " \ + --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 &&