git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] send-email: avoid duplicate In-Reply-To/References
@ 2018-04-17 21:16 Stefan Agner
  2018-04-18  0:54 ` Eric Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2018-04-17 21:16 UTC (permalink / raw)
  To: git; +Cc: stefan

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


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

end of thread, other threads:[~2018-04-18  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-17 21:16 [PATCH] send-email: avoid duplicate In-Reply-To/References Stefan Agner
2018-04-18  0:54 ` Eric Wong
2018-04-18  7:38   ` Stefan Agner

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 NNTP newsgroup(s).