git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-email: restore --in-reply-to superseding behavior

From
Rafael Aquini <aquini@redhat.com>
Date
Jun 24, 2020, 23:45 UTC
Message-ID
<20200624234539.GH1987277@optiplex-lnx>
In-Reply-To
<xmqqo8p85eud.fsf@gitster.c.googlers.com>
On Wed, Jun 24, 2020 at 02:33:14PM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> Rafael Aquini <aquini@redhat.com> writes:
> 
> > git send-email --in-reply-to= fails to override the email headers,
> > if they're present in the output of format-patch, which breakes the
> 
> Will do s/breakes/breaks/ while applying.
>

UGH! I've been fat-fingering typos the whole day, today... Sorry about that one.

 
Show 24 quoted lines
> It makes me wonder, however, why it is a good idea to have the I-R-T
> in the format patch output in the first place.
> 
> >  			elsif (/^In-Reply-To: (.*)/i) {
> > -				$in_reply_to = $1;
> > +				if (!$initial_in_reply_to) {
> > +					$in_reply_to = $1;
> > +				}
> 
> I can see how this would work the way it should for the first
> message we send out, so it would work well for a single patch.
> 
> But what does this change do to the chaining (either making [PATCH
> 1/N] thru [PATCH N/N] as responses to the cover letter [PATCH 0/N],
> or making [PATCH n+1/N] as response to [PATCH n/N] for 1 <= n < N)
> of multiple messages?
> 
> When you prepare a series whose 1..N/N are all pointing at 0/N with
> the already prepared In-Reply-To (so you have N+1 files to send
> out), wouldn't you want to make 0/N a reply to a particular message
> you specify on the command line, while keeping the relationship
> among your messages intact?  Doesn't having $initial_in_reply_to
> (i.e. command line override) help above code break the chaning?
>

This change will make all emails to appear as a reply to the msgid fed to --in-reply-to. I see your point, though, and at its light I think now this patch, is actually incomplete.

With this change we get back the override desired behavior, but it also breaks the contract, according to the man page.

"
 --in-reply-to=<identifier>
     Make the first mail (or all the mails with --no-thread) appear as a reply to the given Message-Id, which
     avoids breaking threads to provide a new patch series. The second and subsequent emails will be sent as
     replies according to the --[no-]chain-reply-to setting.
"

I drove the change based on my usecase, which is marginal to the multi-part reply case.

I guess we just need the following, for a complete solution:
diff --git a/git-send-email.perl b/git-send-email.perl
index dc95656f75..768296ea0a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1699,10 +1699,14 @@ sub process_file {
 				$xfer_encoding = $1 if not defined $xfer_encoding;
 			}
 			elsif (/^In-Reply-To: (.*)/i) {
-				$in_reply_to = $1;
+				if (!$initial_in_reply_to || $thread) {
+					$in_reply_to = $1;
+				}
 			}
 			elsif (/^References: (.*)/i) {
-				$references = $1;
+				if (!$initial_in_reply_to || $thread) {
+					$references = $1;
+				}
 			}
 			elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
 				push @xh, $_;
Previous: Junio C HamanoNext: Rafael Aquini
Message 3 of 8 in “send-email: restore --in-reply-to superseding behavior”
  1. send-email: restore --in-reply-to superseding behaviorRafael Aquini, Jun 24, 2020
  2. Junio C HamanoJun 24, 2020
  3. Rafael AquiniJun 24, 2020
  4. Rafael AquiniJun 25, 2020
  5. Carlo ArenasJun 26, 2020
  6. Rafael AquiniJun 26, 2020
  7. send-email: restore --in-reply-to superseding behaviorRafael Aquini, Jun 29, 2020
  8. Carlo Marcelo Arenas BelónJul 1, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.