{"thread":{"id":"48315","subject":"[PATCH] send-email: avoid duplicate In-Reply-To/References","startedAt":"2018-04-17T21:16:43Z","lastAt":"2018-04-18T07:38:24Z","messageCount":3,"participants":["Stefan Agner","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"344936","messageId":"20180417211630.22873-1-stefan@agner.ch","threadId":"48315","inReplyTo":null,"subject":"[PATCH] send-email: avoid duplicate In-Reply-To/References","fromName":"Stefan Agner","fromEmail":"stefan@agner.ch","sentAt":"2018-04-17T21:16:30Z","receivedAt":"2018-04-17T21:16:43Z","isPatch":true,"sender":{"key":"stefan@agner.ch","avatar":"https://avatars.githubusercontent.com/u/34061?v=4"},"body":"In case a patch already has In-Reply-To or References in the header\n(e.g. when the patch has been created with format-patch --thread)\ngit-send-email should not add another pair of those headers.\nThis is also not allowed according to RFC 5322 Section 3.6:\nhttps://tools.ietf.org/html/rfc5322#section-3.6\n\nAvoid the second pair by reading the current headers into the\nappropriate variables.\n\nSigned-off-by: Stefan Agner <stefan@agner.ch>\n---\nThis addresses the issue reported here:\nhttps://public-inbox.org/git/997160314bbafb3088a401f1c09ccb08@agner.ch/\n\n git-send-email.perl | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 2fa7818ca..7157397fd 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1642,10 +1642,15 @@ foreach my $t (@files) {\n \t\t\telsif (/^Content-Transfer-Encoding: (.*)/i) {\n \t\t\t\t$xfer_encoding = $1 if not defined $xfer_encoding;\n \t\t\t}\n+\t\t\telsif (/^In-Reply-To: (.*)/i) {\n+\t\t\t\t$in_reply_to = $1;\n+\t\t\t}\n+\t\t\telsif (/^References: (.*)/i) {\n+\t\t\t\t$references = $1;\n+\t\t\t}\n \t\t\telsif (!/^Date:\\s/i && /^[-A-Za-z]+:\\s+\\S/) {\n \t\t\t\tpush @xh, $_;\n \t\t\t}\n-\n \t\t} else {\n \t\t\t# In the traditional\n \t\t\t# \"send lots of email\" format,\n-- \n2.17.0\n\n"},{"id":"344962","messageId":"20180418005415.GA31588@dcvr","threadId":"48315","inReplyTo":"20180417211630.22873-1-stefan@agner.ch","subject":"Re: [PATCH] send-email: avoid duplicate In-Reply-To/References","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2018-04-18T00:54:15Z","receivedAt":"2018-04-18T00:54:19Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Stefan Agner <stefan@agner.ch> wrote:\n> This addresses the issue reported here:\n> https://public-inbox.org/git/997160314bbafb3088a401f1c09ccb08@agner.ch/\n\nThanks for bringing this up.\n\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1642,10 +1642,15 @@ foreach my $t (@files) {\n>  \t\t\telsif (/^Content-Transfer-Encoding: (.*)/i) {\n>  \t\t\t\t$xfer_encoding = $1 if not defined $xfer_encoding;\n>  \t\t\t}\n> +\t\t\telsif (/^In-Reply-To: (.*)/i) {\n> +\t\t\t\t$in_reply_to = $1;\n> +\t\t\t}\n> +\t\t\telsif (/^References: (.*)/i) {\n> +\t\t\t\t$references = $1;\n> +\t\t\t}\n\nReferences: can span multiple lines with --thread=deep in format-patch\n(technically any header can be, but References: is common)\n"},{"id":"344972","messageId":"d218005b0c44b7f8a61c82d060352eee@agner.ch","threadId":"48315","inReplyTo":"20180418005415.GA31588@dcvr","subject":"Re: [PATCH] send-email: avoid duplicate In-Reply-To/References","fromName":"Stefan Agner","fromEmail":"stefan@agner.ch","sentAt":"2018-04-18T07:38:13Z","receivedAt":"2018-04-18T07:38:24Z","isPatch":true,"sender":{"key":"stefan@agner.ch","avatar":"https://avatars.githubusercontent.com/u/34061?v=4"},"body":"On 18.04.2018 02:54, Eric Wong wrote:\n> Stefan Agner <stefan@agner.ch> wrote:\n>> This addresses the issue reported here:\n>> https://public-inbox.org/git/997160314bbafb3088a401f1c09ccb08@agner.ch/\n> \n> Thanks for bringing this up.\n> \n>> --- a/git-send-email.perl\n>> +++ b/git-send-email.perl\n>> @@ -1642,10 +1642,15 @@ foreach my $t (@files) {\n>>  \t\t\telsif (/^Content-Transfer-Encoding: (.*)/i) {\n>>  \t\t\t\t$xfer_encoding = $1 if not defined $xfer_encoding;\n>>  \t\t\t}\n>> +\t\t\telsif (/^In-Reply-To: (.*)/i) {\n>> +\t\t\t\t$in_reply_to = $1;\n>> +\t\t\t}\n>> +\t\t\telsif (/^References: (.*)/i) {\n>> +\t\t\t\t$references = $1;\n>> +\t\t\t}\n> \n> References: can span multiple lines with --thread=deep in format-patch\n> (technically any header can be, but References: is common)\n\nI think that is ok because we do\n# First unfold multiline header fields\n\n...\n\nA quick test with 3 patches in --thread=deep mode looks good:\nIn-Reply-To:\n<87d48c04aae0594ebea7567827d08979ad346380.1524034203.git.stefan@agner.ch>\nReferences:\n<06ea66574abfb2dd66adee9996e5fb66903b95a3.1524034203.git.stefan@agner.ch>\n<87d48c04aae0594ebea7567827d08979ad346380.1524034203.git.stefan@agner.ch>\n\n--\nStefan\n"}]}