{"thread":{"id":"5354","subject":"[PATCH] git-send-email: Don't set author_not_sender from Cc: lines","startedAt":"2006-08-22T13:38:39Z","lastAt":"2006-08-23T09:14:19Z","messageCount":3,"participants":["Haavard Skinnemoen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"25744","messageId":"1156253919761-git-send-email-hskinnemoen@atmel.com","threadId":"5354","inReplyTo":null,"subject":"[PATCH] git-send-email: Don't set author_not_sender from Cc: lines","fromName":"Haavard Skinnemoen","fromEmail":"hskinnemoen@atmel.com","sentAt":"2006-08-22T13:38:39Z","receivedAt":"2006-08-22T13:38:39Z","isPatch":true,"sender":{"key":"hskinnemoen@atmel.com","avatar":null},"body":"When an mbox-style patch contains a Cc: line in the header,\ngit-send-email will check the address against the sender specified\non the command line. If they don't match, sender_not_author will\nbe set to the address obtained from the Cc line.\n\nWhen this happens, git-send-email inserts a From: line at the\nbeginning of the message body with the address obtained from the\nCc line in the header, and the sender might be accused of forging\npatch authors.\n\nThis patch fixes this by only updating sender_not_author when\nprocessing From: lines, not when processing Cc: lines.\n\nSigned-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>\n---\n\nThis email was sent using git-send-email with the patch applied. Junio\nwas Cc'ed by editing the patch header -- let's see if it works...\n\n git-send-email.perl |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex a83c7e9..0197454 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -506,7 +506,7 @@ foreach my $t (@files) {\n \t\t\t\tif (/^Subject:\\s+(.*)$/) {\n \t\t\t\t\t$subject = $1;\n \n-\t\t\t\t} elsif (/^(Cc|From):\\s+(.*)$/) {\n+\t\t\t\t} elsif (/^(From):\\s+(.*)$/) {\n \t\t\t\t\tif ($2 eq $from) {\n \t\t\t\t\t\tnext if ($suppress_from);\n \t\t\t\t\t}\n@@ -516,8 +516,11 @@ foreach my $t (@files) {\n \t\t\t\t\tprintf(\"(mbox) Adding cc: %s from line '%s'\\n\",\n \t\t\t\t\t\t$2, $_) unless $quiet;\n \t\t\t\t\tpush @cc, $2;\n+\t\t\t\t} elsif (/^(Cc):\\s+(.*)$/) {\n+\t\t\t\t\tprintf(\"(mbox) Adding cc: %s from line '%s'\\n\",\n+\t\t\t\t\t\t$2, $_) unless $quiet;\n+\t\t\t\t\tpush @cc, $2;\n \t\t\t\t}\n-\n \t\t\t} else {\n \t\t\t\t# In the traditional\n \t\t\t\t# \"send lots of email\" format,\n-- \n1.4.0\n"},{"id":"25776","messageId":"7vd5asjkvb.fsf@assigned-by-dhcp.cox.net","threadId":"5354","inReplyTo":"1156253919761-git-send-email-hskinnemoen@atmel.com","subject":"Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-23T01:34:16Z","receivedAt":"2006-08-23T01:34:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Haavard Skinnemoen <hskinnemoen@atmel.com> writes:\n\n> When an mbox-style patch contains a Cc: line in the header,\n> git-send-email will check the address against the sender specified\n> on the command line. If they don't match, sender_not_author will\n> be set to the address obtained from the Cc line.\n\n> @@ -506,7 +506,7 @@ foreach my $t (@files) {\n>  \t\t\t\tif (/^Subject:\\s+(.*)$/) {\n>  \t\t\t\t\t$subject = $1;\n>  \n> -\t\t\t\t} elsif (/^(Cc|From):\\s+(.*)$/) {\n> +\t\t\t\t} elsif (/^(From):\\s+(.*)$/) {\n>  \t\t\t\t\tif ($2 eq $from) {\n>  \t\t\t\t\t\tnext if ($suppress_from);\n>  \t\t\t\t\t}\n> @@ -516,8 +516,11 @@ foreach my $t (@files) {\n>  \t\t\t\t\tprintf(\"(mbox) Adding cc: %s from line '%s'\\n\",\n>  \t\t\t\t\t\t$2, $_) unless $quiet;\n>  \t\t\t\t\tpush @cc, $2;\n> +\t\t\t\t} elsif (/^(Cc):\\s+(.*)$/) {\n> +\t\t\t\t\tprintf(\"(mbox) Adding cc: %s from line '%s'\\n\",\n> +\t\t\t\t\t\t$2, $_) unless $quiet;\n> +\t\t\t\t\tpush @cc, $2;\n>  \t\t\t\t}\n> -\n>  \t\t\t} else {\n>  \t\t\t\t# In the traditional\n>  \t\t\t\t# \"send lots of email\" format,\n\nThe patch looks wrong.  If your name is on CC: and you want to\nsuppress sending to yourself what happens?\n\nHow about doing something like this instead?\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex a83c7e9..8adb6b9 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -510,7 +510,7 @@ foreach my $t (@files) {\n \t\t\t\t\tif ($2 eq $from) {\n \t\t\t\t\t\tnext if ($suppress_from);\n \t\t\t\t\t}\n-\t\t\t\t\telse {\n+\t\t\t\t\telsif ($1 eq 'From') {\n \t\t\t\t\t\t$author_not_sender = $2;\n \t\t\t\t\t}\n \t\t\t\t\tprintf(\"(mbox) Adding cc: %s from line '%s'\\n\",\n"},{"id":"25792","messageId":"20060823111419.22d92f51@cad-250-152.norway.atmel.com","threadId":"5354","inReplyTo":"7vd5asjkvb.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines","fromName":"Haavard Skinnemoen","fromEmail":"hskinnemoen@atmel.com","sentAt":"2006-08-23T09:14:19Z","receivedAt":"2006-08-23T09:14:19Z","isPatch":true,"sender":{"key":"hskinnemoen@atmel.com","avatar":null},"body":"On Tue, 22 Aug 2006 18:34:16 -0700\nJunio C Hamano <junkio@cox.net> wrote:\n\n> The patch looks wrong.  If your name is on CC: and you want to\n> suppress sending to yourself what happens?\n\nIt will still send it to you, I guess. The documentation only mentions\nwhat happens with From: lines, so I wasn't really sure what behaviour is\nexpected...\n\n> How about doing something like this instead?\n\nYeah, that's probably better. I just tested it by sending a mail to\nmyself, and it doesn't append an extra From: line, so it solves the\nproblem as far as I'm concerned.\n\nHaavard\n\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index a83c7e9..8adb6b9 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -510,7 +510,7 @@ foreach my $t (@files) {\n>  \t\t\t\t\tif ($2 eq $from) {\n>  \t\t\t\t\t\tnext if\n> ($suppress_from); }\n> -\t\t\t\t\telse {\n> +\t\t\t\t\telsif ($1 eq 'From') {\n>  \t\t\t\t\t\t$author_not_sender =\n> $2; }\n>  \t\t\t\t\tprintf(\"(mbox) Adding cc: %s\n> from line '%s'\\n\",\n> \n"}]}