On Mon, Dec 17, 2007 at 12:22:51PM -0800, Joe Perches wrote:
Show 13 quoted lines
> $ let count=0 ; for line in $(cat patch_order) ; do ((count++)); \
> printf -v tmp "%04u-Spelling-%s" $count $line ; \
> tmp=${tmp//\//-} ; tmp=${tmp// /}; \
> git-format-patch -N --thread --start-number $count -s \
> -o patch3 \
> --subject-prefix="[PATCH] Spelling: $line" master $line ; done
> [converted the subjects appropriately]
> $ git-send-email --smtp-server <foo> --smtp-user <bar> \
> --from "Joe Perches <joe@perches.com>" \
> --to "linux-kernel@vger.kernel.org" \
> --cc "Andrew Morton <akpm@linux-foundation.org>" \
> --cc-cmd "../get_maintainer.pl --nogit" \
> --no-thread --suppress-from patch3Ah. The problem is that git-send-email unconditionally adds a message-id. Usually git-format-patch doesn't add one, but for obvious reasons, it must when doing --thread. Here is a fix.
-- >8 -- 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>
---
It will also happily add duplicate --in-reply-to and --references
headers, but those can be suppressed with --no-thread. Arguably, it
should detect this case and turn on --no-thread, but looking at
git-send-email makes me want to claw my eyes out.
git-send-email.perl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
Show changes to git-send-email.perl +4 −1
diff --git a/git-send-email.perl b/git-send-email.perl
index 1d6f466..083466a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -580,7 +580,7 @@ sub send_message
$ccline = "\nCc: $cc";
}
my $sanitized_sender = sanitize_address($sender);
- make_message_id();
+ make_message_id() unless defined($message_id);
my $header = "From: $sanitized_sender
To: $to${ccline}
@@ -718,6 +718,9 @@ foreach my $t (@files) {
}
push @xh, $_;
}
+ elsif (/^Message-Id: (.*)/i) {
+ $message_id = $1;
+ }
elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) {
push @xh, $_;
}
--
1.5.4.rc0.1146.gc97f-dirty