git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stepan Kasal <kasal@ucw.cz>
Cc: GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] send-email: do not insert third header
Date: Mon, 09 Jun 2014 16:25:26 -0700	[thread overview]
Message-ID: <xmqqa99ld5sp.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: 20140607080940.GA8858@camelia.ucw.cz

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

>
> 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) {

  reply	other threads:[~2014-06-09 23:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07  8:09 [PATCH] send-email: do not insert third header Stepan Kasal
2014-06-09 23:25 ` Junio C Hamano [this message]
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=xmqqa99ld5sp.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kasal@ucw.cz \
    /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).