Re: [RFC][PATCH] send-email: add --[no-]xmailer option
On Dec 2, 2014, at 18:34, Eric Wong wrote:
Show 22 quoted lines
> Luis Henriques <henrix@camandro.org> wrote:
>> On Mon, Mar 24, 2014 at 09:38:27PM +0000, Luis Henriques wrote:
>>> Add --[no-]xmailer that allows a user to disable adding the 'X-
>>> Mailer:'
>>> header to the email being sent.
>>>
>>
>> Ping
>>
>> It's been a while since I sent this patch. Is there any interest in
>> having this switch in git-send-email?
>
> I wasn't paying attention when the original was sent, but this
> looks good to me.
>
> Acked-by: Eric Wong <normalperson@yhbt.net>
>
>> I honestly don't like disclosing too much information about my
>> system,
>> in this case which MUA I'm using and its version.
>
> Right on. I would even favor this being the default.
Show 5 quoted lines
> Auto-generated Message-Id headers also shows the use of git-send-
> email;
> perhaps there can be a way to configure that, too. However,
> git-send-email respects manually-added Message-Id headers in the
> original patch, so it's less of a problem, I suppose.
It can be hashed like so to avoid leaking information:
diff --git a/git-send-email.orig b/git-send-email.new
index f3d75e8..d0b4bff 100755
--- a/git-send-email.orig
+++ b/git-send-email.new
@@ -27,6 +27,7 @@ use Data::Dumper;
use Term::ANSIColor;
use File::Temp qw/ tempdir tempfile /;
use File::Spec::Functions qw(catfile);
+use Digest::MD5 qw(md5_hex);
use Error qw(:try);
use Git;
@@ -901,8 +903,10 @@ sub make_message_id {
require Sys::Hostname;
$du_part = 'user@' . Sys::Hostname::hostname();
}
- my $message_id_template = "<%s-git-send-email-%s>";
+ my $message_id_template = "%s-git-send-email-%s";
$message_id = sprintf($message_id_template, $uniq, $du_part);
+ @_ = split /@/, $message_id;
+ $message_id = '<'.substr(md5_hex($_[0]),
0,31).'@'.substr(md5_hex($_[1]),1,31).'>';
#print "new message id = $message_id\n"; # Was useful for debugging
}
---
--Kyle