git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [RFC] send-email: avoid duplicate In-Reply-To and References headers
@ 2017-02-12  0:34 Eric Wong
  2017-02-12  1:41 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2017-02-12  0:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King, Vasco Almeida

When parsing an mbox, it is possible to get existing In-Reply-To
and References headers blindly appended into the headers of
message we generate.   This is probably the wrong thing to do
and we should prioritize what was given in the command-line,
cover letter, and previously-sent messages.

One example I've noticed in the wild was:

https://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw
---
 I'm not completely sure this is what Vasco was doing in that
 message, so it's an RFC for now...

 git-send-email.perl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 068d60b3e6..5ab3d8585c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1543,7 +1543,13 @@ foreach my $t (@files) {
 			elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
 				push @xh, $_;
 			}
-
+			elsif (/^(?:References|In-Reply-To):/i) {
+				if (defined $initial_reply_to || $thread) {
+					warn
+"Ignoring $_ header in mbox body since it conflicts with\n
+--in-reply-to and --thread switches\n"
+				}
+			}
 		} else {
 			# In the traditional
 			# "send lots of email" format,
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers
  2017-02-12  0:34 [RFC] send-email: avoid duplicate In-Reply-To and References headers Eric Wong
@ 2017-02-12  1:41 ` Junio C Hamano
  2017-02-12  2:12   ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2017-02-12  1:41 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Jeff King, Vasco Almeida

Eric Wong <e@80x24.org> writes:

> When parsing an mbox, it is possible to get existing In-Reply-To
> and References headers blindly appended into the headers of
> message we generate.   This is probably the wrong thing to do
> and we should prioritize what was given in the command-line,
> cover letter, and previously-sent messages.
>
> One example I've noticed in the wild was:
>
> https://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw
> ---
>  I'm not completely sure this is what Vasco was doing in that
>  message, so it's an RFC for now...

I think it is sensibleto give priority to the --in-reply-to option
given from the command line over the in-file one.  I am not sure if
we want to drop references, though.  Wouldn't it make more sense to
just add what we got from the command line to what we read from the
file?  I dunno.

>  git-send-email.perl | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 068d60b3e6..5ab3d8585c 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -1543,7 +1543,13 @@ foreach my $t (@files) {
>  			elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
>  				push @xh, $_;
>  			}
> -
> +			elsif (/^(?:References|In-Reply-To):/i) {
> +				if (defined $initial_reply_to || $thread) {
> +					warn
> +"Ignoring $_ header in mbox body since it conflicts with\n
> +--in-reply-to and --thread switches\n"
> +				}
> +			}
>  		} else {
>  			# In the traditional
>  			# "send lots of email" format,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers
  2017-02-12  1:41 ` Junio C Hamano
@ 2017-02-12  2:12   ` Eric Wong
  2017-02-12  2:51     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2017-02-12  2:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King, Vasco Almeida

Junio C Hamano <gitster@pobox.com> wrote:
> Eric Wong <e@80x24.org> writes:
> > When parsing an mbox, it is possible to get existing In-Reply-To
> > and References headers blindly appended into the headers of
> > message we generate.   This is probably the wrong thing to do
> > and we should prioritize what was given in the command-line,
> > cover letter, and previously-sent messages.
> >
> > One example I've noticed in the wild was:
> >
> > https://public-inbox.org/git/20161111124541.8216-17-vascomalmeida@sapo.pt/raw
> > ---
> >  I'm not completely sure this is what Vasco was doing in that
> >  message, so it's an RFC for now...
> 
> I think it is sensibleto give priority to the --in-reply-to option
> given from the command line over the in-file one.  I am not sure if
> we want to drop references, though.  Wouldn't it make more sense to
> just add what we got from the command line to what we read from the
> file?  I dunno.

You're right, existing References in the bodies should probably
be prepended to current ones, as their order should be
oldest-to-newest.

I'll wait on comments a bit and work on a better version w/ tests
next week.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] send-email: avoid duplicate In-Reply-To and References headers
  2017-02-12  2:12   ` Eric Wong
@ 2017-02-12  2:51     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-02-12  2:51 UTC (permalink / raw)
  To: Eric Wong; +Cc: git, Jeff King, Vasco Almeida

Eric Wong <e@80x24.org> writes:

> Junio C Hamano <gitster@pobox.com> wrote:
>> 
>> I think it is sensibleto give priority to the --in-reply-to option
>> given from the command line over the in-file one.  I am not sure if
>> we want to drop references, though.  Wouldn't it make more sense to
>> just add what we got from the command line to what we read from the
>> file?  I dunno.
>
> You're right, existing References in the bodies should probably
> be prepended to current ones, as their order should be
> oldest-to-newest.

If you were to go that way, it may also make sense to demote the
original In-Reply-To you find in the file to an entry in the
References list, if it does not already appear there.

I didn't check the RFCs, but I think your original motivation is to
ensure that there is not more than one messages to which the current
message is replying to, iow, to ensure that there is only one message
that is In-Reply-To, so appending would not be a good solution there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-12  2:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-12  0:34 [RFC] send-email: avoid duplicate In-Reply-To and References headers Eric Wong
2017-02-12  1:41 ` Junio C Hamano
2017-02-12  2:12   ` Eric Wong
2017-02-12  2:51     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).