{"thread":{"id":"36868","subject":"[PATCH] send-email: do not insert third header","startedAt":"2014-06-07T08:09:40Z","lastAt":"2014-06-10T07:05:06Z","messageCount":4,"participants":["Stepan Kasal","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"243592","messageId":"20140607080940.GA8858@camelia.ucw.cz","threadId":"36868","inReplyTo":null,"subject":"[PATCH] send-email: do not insert third header","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-06-07T08:09:40Z","receivedAt":"2014-06-07T08:09:40Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"It is sometimes desirable to insert several header lines at the top of\nthe body, e.g., if From or Date differs from the mail header.\n(Linus even recommends to use this second header for all kernel\nsubmissions.)\n\nsend-email has a minimal support for this; make sure it is not applied\nwhen there is a second header already inserted in the patch file.\n\nSigned-off-by: Stepan Kasal <kasal@ucw.cz>\n---\n git-send-email.perl | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 9949db0..891df13 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1456,7 +1456,9 @@ foreach my $t (@files) {\n \t}\n \n \tif (defined $sauthor and $sauthor ne $sender) {\n-\t\t$message = \"From: $author\\n\\n$message\";\n+\t\tif ($message !~ m/^From: /) {\n+\t\t\t$message = \"From: $author\\n\\n$message\";\n+\t\t}\n \t\tif (defined $author_encoding) {\n \t\t\tif ($has_content_type) {\n \t\t\t\tif ($body_encoding eq $author_encoding) {\n-- \n1.9.2.msysgit.0.496.g9a846d6\n"},{"id":"243686","messageId":"xmqqa99ld5sp.fsf@gitster.dls.corp.google.com","threadId":"36868","inReplyTo":"20140607080940.GA8858@camelia.ucw.cz","subject":"Re: [PATCH] send-email: do not insert third header","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-09T23:25:26Z","receivedAt":"2014-06-09T23:25:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stepan Kasal <kasal@ucw.cz> writes:\n\n> It is sometimes desirable to insert several header lines at the top of\n> the body, e.g., if From or Date differs from the mail header.\n> (Linus even recommends to use this second header for all kernel\n> submissions.)\n>\n> send-email has a minimal support for this; make sure it is not applied\n> when there is a second header already inserted in the patch file.\n\nI have a slight suspicion that you are reading the recommendation\nwrong.  We do not recommend to record these in-body headers in the\nmessage of the commit object (the recommendation is to prepend\nin-body headers to the message of the commit object when sending it\nout for review---it pretty much assumes that the underlying commit\ndoes not have these in-body headers that are used only during the\ntransit over e-mail forwarding chain).\n\nBut your patch seems to assume that the input message to send-email\nalready has the in-body header.  Doesn't that indicate a misuse of\nthe tool, making this new \"feature\" smell more like a way to\nencourage such a misuse by covering up the result?\n\nI dunno.\n\n>\n> Signed-off-by: Stepan Kasal <kasal@ucw.cz>\n> ---\n>  git-send-email.perl | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 9949db0..891df13 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1456,7 +1456,9 @@ foreach my $t (@files) {\n>  \t}\n>  \n>  \tif (defined $sauthor and $sauthor ne $sender) {\n> -\t\t$message = \"From: $author\\n\\n$message\";\n> +\t\tif ($message !~ m/^From: /) {\n> +\t\t\t$message = \"From: $author\\n\\n$message\";\n> +\t\t}\n>  \t\tif (defined $author_encoding) {\n>  \t\t\tif ($has_content_type) {\n>  \t\t\t\tif ($body_encoding eq $author_encoding) {\n"},{"id":"243703","messageId":"xmqqwqcpb9yx.fsf@gitster.dls.corp.google.com","threadId":"36868","inReplyTo":"xmqqa99ld5sp.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] send-email: do not insert third header","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-10T05:38:14Z","receivedAt":"2014-06-10T05:38:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Stepan Kasal <kasal@ucw.cz> writes:\n>\n>> It is sometimes desirable to insert several header lines at the top of\n>> the body, e.g., if From or Date differs from the mail header.\n>> (Linus even recommends to use this second header for all kernel\n>> submissions.)\n>>\n>> send-email has a minimal support for this; make sure it is not applied\n>> when there is a second header already inserted in the patch file.\n>\n> I have a slight suspicion that you are reading the recommendation\n> wrong.  We do not recommend to record these in-body headers in the\n> message of the commit object (the recommendation is to prepend\n> in-body headers to the message of the commit object when sending it\n> out for review---it pretty much assumes that the underlying commit\n> does not have these in-body headers that are used only during the\n> transit over e-mail forwarding chain).\n>\n> But your patch seems to assume that the input message to send-email\n> already has the in-body header.  Doesn't that indicate a misuse of\n> the tool, making this new \"feature\" smell more like a way to\n> encourage such a misuse by covering up the result?\n>\n> I dunno.\n\nI forgot to mention that possible enhancements. As you mentioned,\nthere is only a minimal support for this in send-email.  After you\ncommitted somebody else's patch in your tree, format-patch will\nproduce the normal From: and Date: using the original author's\nidentity and timestamp, but send-email only uses the in-body header\nfor \"From:\" (but not \"Date:\") to propagate this information and only\nwhen the author is different from yourself.  It is plausible that\ntwo new options to tell send-email to optionally\n\n (1) propagate \"Date:\" in the output from format-patch as an in-body\n     header; and\n\n (2) propagate \"From:\" in the output from format-patch as an in-body\n     header even when you are sending out your own patch\n\nwould support the recent kernel submission convention better.\n"},{"id":"243711","messageId":"20140610070506.GA23093@camelia.ucw.cz","threadId":"36868","inReplyTo":"xmqqwqcpb9yx.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] send-email: do not insert third header","fromName":"Stepan Kasal","fromEmail":"kasal@ucw.cz","sentAt":"2014-06-10T07:05:06Z","receivedAt":"2014-06-10T07:05:06Z","isPatch":true,"sender":{"key":"kasal@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/1481596?v=4"},"body":"On Mon, Jun 09, 2014 at 10:38:14PM -0700, Junio C Hamano wrote:\n> two new options [..]\n> would support the recent kernel submission convention better.\n\nindeed, but they are not there and I do not volunteer to write them.\n\nInstead, I edit the generated patches to add the necessary headers.\nBut if send-mail is used to mass-send these edited mails, it adds yet\nanother header.  As a quick solution, I fixed send-mail, so that it\nrespects the header added by hand.\n\nEven if send-mail is in the future enhanced according to your\nproposal, it is still possible that hand-crafted headers will be\nneeded for a special purpose, so my patch still may come handy.\n\nStepan\n"}]}