send-email: avoid duplicate In-Reply-To/References
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Agner committed
Apr 17, 2018 at 23:16 UTC
256be1d3f0439b397a573f90868b8d09e11afbdf
1 file changed
+6
-1
git-send-email.perl
+6
-1
@@ -1642,10 +1642,15 @@ foreach my $t (@files) {
1642
elsif (/^Content-Transfer-Encoding: (.*)/i) {
1643
$xfer_encoding = $1 if not defined $xfer_encoding;
1644
}
1645
+ elsif (/^In-Reply-To: (.*)/i) {
1646
+ $in_reply_to = $1;
1647
+ }
1648
+ elsif (/^References: (.*)/i) {
1649
+ $references = $1;
1650
+ }
1651
elsif (!/^Date:\s/i && /^[-A-Za-z]+:\s+\S/) {
1652
push @xh, $_;
1653
}
1648
-
1654
} else {
1655
# In the traditional
1656
# "send lots of email" format,