{"thread":{"id":"40179","subject":"[PATCH] git-send-email: Delete additional From message body","startedAt":"2015-08-26T09:25:20Z","lastAt":"2015-08-26T22:38:42Z","messageCount":2,"participants":["brilliantov@inbox.ru","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"268721","messageId":"1440581120-14156-1-git-send-email-brilliantov@inbox.ru","threadId":"40179","inReplyTo":null,"subject":"[PATCH] git-send-email: Delete additional From message body","fromName":"","fromEmail":"brilliantov@inbox.ru","sentAt":"2015-08-26T09:25:20Z","receivedAt":"2015-08-26T09:25:20Z","isPatch":true,"sender":{"key":"brilliantov@inbox.ru","avatar":null},"body":"Additional From added to message body if git-send-email run\nwith --from parameters\n\nSigned-off-by: Brilliantov Kirill Vladimirovich <brilliantov@inbox.ru>\n---\n git-send-email.perl | 25 +++++++++++--------------\n 1 file changed, 11 insertions(+), 14 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex b660cc2..92ec74a 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1522,24 +1522,21 @@ foreach my $t (@files) {\n \t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n \t}\n \n-\tif (defined $sauthor and $sauthor ne $sender) {\n-\t\t$message = \"From: $author\\n\\n$message\";\n-\t\tif (defined $author_encoding) {\n-\t\t\tif ($has_content_type) {\n-\t\t\t\tif ($body_encoding eq $author_encoding) {\n-\t\t\t\t\t# ok, we already have the right encoding\n-\t\t\t\t}\n-\t\t\t\telse {\n-\t\t\t\t\t# uh oh, we should re-encode\n-\t\t\t\t}\n+\tif (defined $author_encoding) {\n+\t\tif ($has_content_type) {\n+\t\t\tif ($body_encoding eq $author_encoding) {\n+\t\t\t\t# ok, we already have the right encoding\n \t\t\t}\n \t\t\telse {\n-\t\t\t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n-\t\t\t\t$has_content_type = 1;\n-\t\t\t\tpush @xh,\n-\t\t\t\t  \"Content-Type: text/plain; charset=$author_encoding\";\n+\t\t\t\t# uh oh, we should re-encode\n \t\t\t}\n \t\t}\n+\t\telse {\n+\t\t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n+\t\t\t$has_content_type = 1;\n+\t\t\tpush @xh,\n+\t\t\t  \"Content-Type: text/plain; charset=$author_encoding\";\n+\t\t}\n \t}\n \tif (defined $target_xfer_encoding) {\n \t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n-- \n2.1.4\n"},{"id":"268764","messageId":"xmqqk2sh1xql.fsf@gitster.dls.corp.google.com","threadId":"40179","inReplyTo":"1440581120-14156-1-git-send-email-brilliantov@inbox.ru","subject":"Re: [PATCH] git-send-email: Delete additional From message body","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-08-26T22:38:42Z","receivedAt":"2015-08-26T22:38:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"brilliantov@inbox.ru writes:\n\n> Additional From added to message body if git-send-email run\n> with --from parameters\n>\n> Signed-off-by: Brilliantov Kirill Vladimirovich <brilliantov@inbox.ru>\n> ---\n>  git-send-email.perl | 25 +++++++++++--------------\n>  1 file changed, 11 insertions(+), 14 deletions(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index b660cc2..92ec74a 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1522,24 +1522,21 @@ foreach my $t (@files) {\n>  \t\t$subject = quote_subject($subject, $auto_8bit_encoding);\n>  \t}\n>  \n> -\tif (defined $sauthor and $sauthor ne $sender) {\n> -\t\t$message = \"From: $author\\n\\n$message\";\n\nThis condition attempts to say \"Look at the author taken from the\nFrom: line of the message, and if that is different from the sender\n(which will be recorded in the header of the resulting e-mail), then\nwe do need to add an additional in-body From: line to record the\nauthor of the commit, who may be different from the name that would\nappear in the e-mail.\"\n\nIn other words, the \"Additional From\" is very much deliberate when\nthe \"--from\" option is used and is different from the patch author.\nAnd I do not see this \"add in-body header if the author and the\nsender are different\" you are removing from here appear anywhere in\nthe added text of your patch.  So one consequence of this patch is\nto _never_ use the in-body From: line.\n\nThat needs a serious justification.\n\nNow, it is entirely possible that what you wanted to do (and what\nyou are doing) in this patch may be different from \"unconditionally,\nremove the in-body From: line\".  Perhaps the code mistakenly\ndeclares that the sender given via \"--from\" and the author are\ndifferent, possibly due to a bug in rfc2047 unquoting code or\nsomething, and you are only trying to make sure that the code\nnotices they are really the same.  But I somehow have a feeling that\nthat is not what is going on, because in such a patch, there still\nwill be some code that adds \"From: $author\" at the very beginning of\noutgoing message body; such a fix might update the \"if ()\" condition\nused to guard it (e.g. $sauthor and $sender may have to get further\ncleansed before comparing), but I do not see anything of that sort,\neither.  Also all the changes below do not have anything to do with\nthe additional in-body \"From: \" line.\n\nSo, I dunno.  I cannot tell what you are trying to do, and the only\nimmediate effect of the change I can read is that in-body \"From:\"\nline is unconditionally disabled, which is certainly not something\nwe would want to do.\n\nPuzzled...\n\n\n> -\t\tif (defined $author_encoding) {\n> -\t\t\tif ($has_content_type) {\n> -\t\t\t\tif ($body_encoding eq $author_encoding) {\n> -\t\t\t\t\t# ok, we already have the right encoding\n> -\t\t\t\t}\n> -\t\t\t\telse {\n> -\t\t\t\t\t# uh oh, we should re-encode\n> -\t\t\t\t}\n> +\tif (defined $author_encoding) {\n> +\t\tif ($has_content_type) {\n> +\t\t\tif ($body_encoding eq $author_encoding) {\n> +\t\t\t\t# ok, we already have the right encoding\n>  \t\t\t}\n>  \t\t\telse {\n> -\t\t\t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n> -\t\t\t\t$has_content_type = 1;\n> -\t\t\t\tpush @xh,\n> -\t\t\t\t  \"Content-Type: text/plain; charset=$author_encoding\";\n> +\t\t\t\t# uh oh, we should re-encode\n>  \t\t\t}\n>  \t\t}\n> +\t\telse {\n> +\t\t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n> +\t\t\t$has_content_type = 1;\n> +\t\t\tpush @xh,\n> +\t\t\t  \"Content-Type: text/plain; charset=$author_encoding\";\n> +\t\t}\n>  \t}\n>  \tif (defined $target_xfer_encoding) {\n>  \t\t$xfer_encoding = '8bit' if not defined $xfer_encoding;\n"}]}