From: "Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Harald Nordgren <haraldnordgren@gmail.com>,
Harald Nordgren <haraldnordgren@gmail.com>
Subject: [PATCH v2] send-email: clarify missing subject error
Date: Mon, 10 Aug 2026 17:53:32 +0000 [thread overview]
Message-ID: <pull.2375.v2.git.git.1786384412423.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2375.git.git.1786267394375.gitgitgadget@gmail.com>
From: Harald Nordgren <haraldnordgren@gmail.com>
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>
---
send-email: clarify missing subject error
Explain the required Subject: prefix when a message file has no subject.
Terminate the error with a newline so Perl does not append its internal
source location.
Changes in v2:
* Remove the incorrect claim that Subject: must be the first line.
Report the missing header directly as No 'Subject:' line in '<file>'.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2375%2FHaraldNordgren%2Ffix%2Fsend-email-subject-error-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2375/HaraldNordgren/fix/send-email-subject-error-v2
Pull-Request: https://github.com/git/git/pull/2375
Range-diff vs v1:
1: fe4171b0dc ! 1: 7002c5d5f1 send-email: clarify missing subject error
@@ Metadata
## Commit message ##
send-email: clarify missing subject error
- Explain the required Subject: prefix when a message file has no subject.
+ 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.
@@ git-send-email.perl: sub get_patch_subject {
}
close $fh;
- die sprintf(__("No subject line in %s?"), $fn);
-+ die sprintf(__("No subject line in %s. " .
-+ "The first line must start with \"Subject: \"\n"), $fn);
++ die sprintf(__("No 'Subject:' line in '%s'\n"), $fn);
}
if ($compose) {
@@ t/t9001-send-email.sh: test_expect_success $PREREQ 'detects ambiguous reference/
+ --to=nobody@example.com \
+ no-subject.patch 2>actual &&
+ cat >expect <<-\EOF &&
-+ No subject line in no-subject.patch. The first line must start with "Subject: "
++ No '\''Subject:'\'' line in '\''no-subject.patch'\''
+ EOF
+ test_cmp expect actual
+'
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 <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 &&
base-commit: 010afd3166ddc64c9863b1506f12cbcdda0d4ea1
--
gitgitgadget
next prev parent reply other threads:[~2026-08-10 17:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 9:23 [PATCH] send-email: clarify missing subject error Harald Nordgren via GitGitGadget
2026-08-09 19:13 ` Junio C Hamano
2026-08-10 9:48 ` Harald Nordgren
2026-08-10 15:28 ` Junio C Hamano
2026-08-10 17:53 ` Harald Nordgren via GitGitGadget [this message]
2026-08-10 21:09 ` [PATCH v2] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.2375.v2.git.git.1786384412423.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=haraldnordgren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox