1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-05 19:56:12 +02:00

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>
This commit is contained in:
Stefan Agner 2018-04-17 23:16:30 +02:00 committed by Junio C Hamano
parent 468165c1d8
commit 256be1d3f0

View File

@ -1642,10 +1642,15 @@ sub send_message {
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,