{"thread":{"id":"45117","subject":"[RFC] send-email: avoid duplicate In-Reply-To and References headers","startedAt":"2017-02-12T00:34:39Z","lastAt":"2017-02-12T02:51:25Z","messageCount":4,"participants":["Eric Wong","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"311352","messageId":"20170212003432.GA19519@starla","threadId":"45117","inReplyTo":null,"subject":"[RFC] send-email: avoid duplicate In-Reply-To and References headers","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2017-02-12T00:34:32Z","receivedAt":"2017-02-12T00:34:39Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"When parsing an mbox, it is possible to get existing In-Reply-To\nand References headers blindly appended into the headers of\nmessage we generate.   This is probably the wrong thing to do\nand we should prioritize what was given in the command-line,\ncover letter, and previously-sent messages.\n\nOne example I've noticed in the wild was:\n\nhttps://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw\n---\n I'm not completely sure this is what Vasco was doing in that\n message, so it's an RFC for now...\n\n git-send-email.perl | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 068d60b3e6..5ab3d8585c 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1543,7 +1543,13 @@ foreach my $t (@files) {\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\telsif (/^(?:References|In-Reply-To):/i) {\n+\t\t\t\tif (defined $initial_reply_to || $thread) {\n+\t\t\t\t\twarn\n+\"Ignoring $_ header in mbox body since it conflicts with\\n\n+--in-reply-to and --thread switches\\n\"\n+\t\t\t\t}\n+\t\t\t}\n \t\t} else {\n \t\t\t# In the traditional\n \t\t\t# \"send lots of email\" format,\n-- \nEW\n\n"},{"id":"311353","messageId":"xmqq60kggp8r.fsf@gitster.mtv.corp.google.com","threadId":"45117","inReplyTo":"20170212003432.GA19519@starla","subject":"Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-12T01:41:08Z","receivedAt":"2017-02-12T01:41:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <e@80x24.org> writes:\n\n> When parsing an mbox, it is possible to get existing In-Reply-To\n> and References headers blindly appended into the headers of\n> message we generate.   This is probably the wrong thing to do\n> and we should prioritize what was given in the command-line,\n> cover letter, and previously-sent messages.\n>\n> One example I've noticed in the wild was:\n>\n> https://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw\n> ---\n>  I'm not completely sure this is what Vasco was doing in that\n>  message, so it's an RFC for now...\n\nI think it is sensibleto give priority to the --in-reply-to option\ngiven from the command line over the in-file one.  I am not sure if\nwe want to drop references, though.  Wouldn't it make more sense to\njust add what we got from the command line to what we read from the\nfile?  I dunno.\n\n>  git-send-email.perl | 8 +++++++-\n>  1 file changed, 7 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 068d60b3e6..5ab3d8585c 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1543,7 +1543,13 @@ foreach my $t (@files) {\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\telsif (/^(?:References|In-Reply-To):/i) {\n> +\t\t\t\tif (defined $initial_reply_to || $thread) {\n> +\t\t\t\t\twarn\n> +\"Ignoring $_ header in mbox body since it conflicts with\\n\n> +--in-reply-to and --thread switches\\n\"\n> +\t\t\t\t}\n> +\t\t\t}\n>  \t\t} else {\n>  \t\t\t# In the traditional\n>  \t\t\t# \"send lots of email\" format,\n"},{"id":"311354","messageId":"20170212021208.GA16358@starla","threadId":"45117","inReplyTo":"xmqq60kggp8r.fsf@gitster.mtv.corp.google.com","subject":"Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2017-02-12T02:12:08Z","receivedAt":"2017-02-12T02:12:14Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <e@80x24.org> writes:\n> > When parsing an mbox, it is possible to get existing In-Reply-To\n> > and References headers blindly appended into the headers of\n> > message we generate.   This is probably the wrong thing to do\n> > and we should prioritize what was given in the command-line,\n> > cover letter, and previously-sent messages.\n> >\n> > One example I've noticed in the wild was:\n> >\n> > https://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw\n> > ---\n> >  I'm not completely sure this is what Vasco was doing in that\n> >  message, so it's an RFC for now...\n> \n> I think it is sensibleto give priority to the --in-reply-to option\n> given from the command line over the in-file one.  I am not sure if\n> we want to drop references, though.  Wouldn't it make more sense to\n> just add what we got from the command line to what we read from the\n> file?  I dunno.\n\nYou're right, existing References in the bodies should probably\nbe prepended to current ones, as their order should be\noldest-to-newest.\n\nI'll wait on comments a bit and work on a better version w/ tests\nnext week.\n"},{"id":"311355","messageId":"xmqq1sv4glzu.fsf@gitster.mtv.corp.google.com","threadId":"45117","inReplyTo":"20170212021208.GA16358@starla","subject":"Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-12T02:51:17Z","receivedAt":"2017-02-12T02:51:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <e@80x24.org> writes:\n\n> Junio C Hamano <gitster@pobox.com> wrote:\n>> \n>> I think it is sensibleto give priority to the --in-reply-to option\n>> given from the command line over the in-file one.  I am not sure if\n>> we want to drop references, though.  Wouldn't it make more sense to\n>> just add what we got from the command line to what we read from the\n>> file?  I dunno.\n>\n> You're right, existing References in the bodies should probably\n> be prepended to current ones, as their order should be\n> oldest-to-newest.\n\nIf you were to go that way, it may also make sense to demote the\noriginal In-Reply-To you find in the file to an entry in the\nReferences list, if it does not already appear there.\n\nI didn't check the RFCs, but I think your original motivation is to\nensure that there is not more than one messages to which the current\nmessage is replying to, iow, to ensure that there is only one message\nthat is In-Reply-To, so appending would not be a good solution there.\n"}]}