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

[PATCH] send-email: avoid duplicate In-Reply-To/References

From
Stefan Agner <stefan@agner.ch>
Date
Apr 17, 2018, 21:16 UTC
Message-ID
<20180417211630.22873-1-stefan@agner.ch>

In case a patch already has In-Reply-To or References in the header (e.g. when the patch has been created with format-patch --thread) git-send-email should not add another pair of those headers. This is also not allowed according to RFC 5322 Section 3.6: https://tools.ietf.org/html/rfc5322#section-3.6

Avoid the second pair by reading the current headers into the appropriate variables.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
This addresses the issue reported here:
https://public-inbox.org/git/997160314bbafb3088a401f1c09ccb08@agner.ch/
 git-send-email.perl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 2fa7818ca..7157397fd 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1642,10 +1642,15 @@ foreach my $t (@files) {
 			elsif (/^Content-Transfer-Encoding: (.*)/i) {
 				$xfer_encoding = $1 if not defined $xfer_encoding;
 			}
+			elsif (/^In-Reply-To: (.*)/i) {
+				$in_reply_to = $1;
+			}
+			elsif (/^References: (.*)/i) {
+				$references = $1;
+			}
 			elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
 				push @xh, $_;
 			}
-
 		} else {
 			# In the traditional
 			# "send lots of email" format,
-- 
2.17.0
Next: Eric Wong
Message 1 of 3 in “send-email: avoid duplicate In-Reply-To/References”
  1. send-email: avoid duplicate In-Reply-To/ReferencesStefan Agner, Apr 17, 2018
  2. Eric WongApr 18, 2018
  3. Stefan AgnerApr 18, 2018

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.