git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stepan Kasal <kasal@ucw.cz>
To: GIT Mailing-list <git@vger.kernel.org>
Subject: [PATCH] send-email: do not insert third header
Date: Sat, 7 Jun 2014 10:09:40 +0200	[thread overview]
Message-ID: <20140607080940.GA8858@camelia.ucw.cz> (raw)

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 <kasal@ucw.cz>
---
 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

             reply	other threads:[~2014-06-07  8:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07  8:09 Stepan Kasal [this message]
2014-06-09 23:25 ` [PATCH] send-email: do not insert third header Junio C Hamano
2014-06-10  5:38   ` Junio C Hamano
2014-06-10  7:05     ` Stepan Kasal

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=20140607080940.GA8858@camelia.ucw.cz \
    --to=kasal@ucw.cz \
    --cc=git@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).