[PATCH] send-email: do not insert third header

Subsystems: the rest

STALE3741d

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] send-email: do not insert third header

From: Stepan Kasal <hidden>
Date: 2016-06-15 23:01:32

It is sometimes desirable to insert several header lines at the top of
the body, e.g., if From or Date differs from the mail header.
(Linus even recommends to use this second header for all kernel
submissions.)

send-email has a minimal support for this; make sure it is not applied
when there is a second header already inserted in the patch file.

Signed-off-by: Stepan Kasal <redacted>
---
 git-send-email.perl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..891df13 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1456,7 +1456,9 @@ foreach my $t (@files) {
 	}
 
 	if (defined $sauthor and $sauthor ne $sender) {
-		$message = "From: $author\n\n$message";
+		if ($message !~ m/^From: /) {
+			$message = "From: $author\n\n$message";
+		}
 		if (defined $author_encoding) {
 			if ($has_content_type) {
 				if ($body_encoding eq $author_encoding) {
-- 
1.9.2.msysgit.0.496.g9a846d6

Re: [PATCH] send-email: do not insert third header

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:01:33

Stepan Kasal [off-list ref] writes:
It is sometimes desirable to insert several header lines at the top of
the body, e.g., if From or Date differs from the mail header.
(Linus even recommends to use this second header for all kernel
submissions.)

send-email has a minimal support for this; make sure it is not applied
when there is a second header already inserted in the patch file.
I have a slight suspicion that you are reading the recommendation
wrong.  We do not recommend to record these in-body headers in the
message of the commit object (the recommendation is to prepend
in-body headers to the message of the commit object when sending it
out for review---it pretty much assumes that the underlying commit
does not have these in-body headers that are used only during the
transit over e-mail forwarding chain).

But your patch seems to assume that the input message to send-email
already has the in-body header.  Doesn't that indicate a misuse of
the tool, making this new "feature" smell more like a way to
encourage such a misuse by covering up the result?

I dunno.
quoted hunk
Signed-off-by: Stepan Kasal <redacted>
---
 git-send-email.perl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..891df13 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1456,7 +1456,9 @@ foreach my $t (@files) {
 	}
 
 	if (defined $sauthor and $sauthor ne $sender) {
-		$message = "From: $author\n\n$message";
+		if ($message !~ m/^From: /) {
+			$message = "From: $author\n\n$message";
+		}
 		if (defined $author_encoding) {
 			if ($has_content_type) {
 				if ($body_encoding eq $author_encoding) {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help