Commit 4f3d3703 authored by Jeff King's avatar Jeff King Committed by Junio C Hamano

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: default avatarJeff King <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 6851162a
...@@ -527,7 +527,7 @@ sub send_message ...@@ -527,7 +527,7 @@ sub send_message
$ccline = "\nCc: $cc"; $ccline = "\nCc: $cc";
} }
my $sanitized_sender = sanitize_address($sender); my $sanitized_sender = sanitize_address($sender);
make_message_id(); make_message_id() unless defined($message_id);
my $header = "From: $sanitized_sender my $header = "From: $sanitized_sender
To: $to${ccline} To: $to${ccline}
...@@ -643,6 +643,9 @@ sub send_message ...@@ -643,6 +643,9 @@ sub send_message
} }
push @xh, $_; push @xh, $_;
} }
elsif (/^Message-Id: (.*)/i) {
$message_id = $1;
}
elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) { elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
push @xh, $_; push @xh, $_;
} }
...@@ -728,6 +731,7 @@ sub send_message ...@@ -728,6 +731,7 @@ sub send_message
$references = "$message_id"; $references = "$message_id";
} }
} }
$message_id = undef;
} }
if ($compose) { if ($compose) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment