@matheusbsbs / matheus-bagliano / commits / 4f3d37035a
Fork 0

git-send-email: avoid duplicate message-ids

We used to unconditionally add a message-id to the outgoing email without bothering to check if it already had one. Instead, let's use the existing one. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 17, 2007 at 15:51 UTC 4f3d37035a7c735a3b69f962656819f4ff7e4927
1 file changed +5 -1
git-send-email.perl
+5 -1
@@ -527,7 +527,7 @@ sub send_message
527 $ccline = "\nCc: $cc";
528 }
529 my $sanitized_sender = sanitize_address($sender);
530 - make_message_id();
530 + make_message_id() unless defined($message_id);
531
532 my $header = "From: $sanitized_sender
533 To: $to${ccline}
@@ -643,6 +643,9 @@ foreach my $t (@files) {
643 }
644 push @xh, $_;
645 }
646 + elsif (/^Message-Id: (.*)/i) {
647 + $message_id = $1;
648 + }
649 elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
650 push @xh, $_;
651 }
@@ -728,6 +731,7 @@ foreach my $t (@files) {
731 $references = "$message_id";
732 }
733 }
734 + $message_id = undef;
735 }
736
737 if ($compose) {