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

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

From
Rafael Aquini <aquini@redhat.com>
Date
Jun 29, 2020, 14:11 UTC
Message-ID
<20200629141104.2522011-1-aquini@redhat.com>
In-Reply-To
<xmqqo8p85eud.fsf@gitster.c.googlers.com>

git send-email --in-reply-to= fails to override In-Reply-To email headers, if they're present in the output of format-patch, even when explicitly told to do so by the option --no-thread, which breaks the contract of the command line switch option, per its 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.
"

This patch fixes the aformentioned issue, by bringing --in-reply-to's old overriding behavior back.

Fixes: 256be1d3f0 (send-email: avoid duplicate In-Reply-To/References, 2018-04-17)
Signed-off-by: Rafael Aquini <aquini@redhat.com>
---
v2 changelog:
* conform to the command manual page, when send-email threading is requested
 git-send-email.perl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index dc95656f75..36c47bae1d 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, $_;
-- 
2.23.0
Previous: Rafael AquiniNext: Carlo Marcelo Arenas Belón
Message 7 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.