All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] send-email: clarify missing subject error
@ 2026-08-09  9:23 Harald Nordgren via GitGitGadget
  0 siblings, 0 replies; only message in thread
From: Harald Nordgren via GitGitGadget @ 2026-08-09  9:23 UTC (permalink / raw)
  To: git; +Cc: Harald Nordgren, Harald Nordgren

From: Harald Nordgren <haraldnordgren@gmail.com>

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.

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.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2375%2FHaraldNordgren%2Ffix%2Fsend-email-subject-error-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2375/HaraldNordgren/fix/send-email-subject-error-v1
Pull-Request: https://github.com/git/git/pull/2375

 git-send-email.perl   |  3 ++-
 t/t9001-send-email.sh | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index bb8ddd1eef..4d76d53c49 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -863,7 +863,8 @@ 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. " .
+		"The first line must start with \"Subject: \"\n"), $fn);
 }
 
 if ($compose) {
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e9d814a34a..a403dd278b 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. The first line must start with "Subject: "
+	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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-09  9:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-09  9:23 [PATCH] send-email: clarify missing subject error Harald Nordgren via GitGitGadget

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.