threads / rfc / 36286

RFC patchsend-email: add --[no-]xmailer option

Subject: [RFC][PATCH] send-email: add --[no-]xmailer option

## tl;dr

13 messages between Mar 24, 2014 and Dec 4, 2014. Diffs are folded; open one to read it.

replies: 12people: 4as markdown or json

Luis Henriques· Mar 24, 2014, 21:38 UTC · lore

Add --[no-]xmailer that allows a user to disable adding the 'X-Mailer:' header to the email being sent.

Signed-off-by: Luis Henriques <henrix@camandro.org>
---
 Documentation/config.txt         |  1 +
 Documentation/git-send-email.txt |  3 +++
 git-send-email.perl              | 12 ++++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)
Show changes to 3 files +14 −2

Documentation/config.txt, Documentation/git-send-email.txt, git-send-email.perl

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 73c8973..c33d5a1 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2222,6 +2222,7 @@ sendemail.smtpserveroption::
 sendemail.smtpuser::
 sendemail.thread::
 sendemail.validate::
+sendemail.xmailer::
 	See linkgit:git-send-email[1] for description.
 
 sendemail.signedoffcc::
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f0e57a5..fab6264 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -131,6 +131,9 @@ Note that no attempts whatsoever are made to validate the encoding.
 	Specify encoding of compose message. Default is the value of the
 	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
 
+--xmailer::
+	Prevent adding the "X-Mailer:" header.  Default value is
+	'sendemail.xmailer'.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index fdb0029..8789124 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
+    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
     --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
@@ -174,6 +175,9 @@ my $force = 0;
 my $multiedit;
 my $editor;
 
+# Usage of X-Mailer email header
+my $xmailer;
+
 sub do_edit {
 	if (!defined($editor)) {
 		$editor = Git::command_oneline('var', 'GIT_EDITOR');
@@ -214,7 +218,8 @@ my %config_bool_settings = (
     "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
     "validate" => [\$validate, 1],
     "multiedit" => [\$multiedit, undef],
-    "annotate" => [\$annotate, undef]
+    "annotate" => [\$annotate, undef],
+    "xmailer" => [\$xmailer, 1]
 );
 
 my %config_settings = (
@@ -311,6 +316,7 @@ my $rc = GetOptions("h" => \$help,
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
+		    "xmailer!" => \$xmailer,
 	 );
 
 usage() if $help;
@@ -1144,8 +1150,10 @@ To: $to${ccline}
 Subject: $subject
 Date: $date
 Message-Id: $message_id
-X-Mailer: git-send-email $gitversion
 ";
+	if ($xmailer) {
+		$header .= "X-Mailer: git-send-email $gitversion\n";
+	}
 	if ($reply_to) {
 
 		$header .= "In-Reply-To: $reply_to\n";
-- 
1.9.1
Luis Henriques· Dec 2, 2014, 19:32 UTC · re: Luis Henriques · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

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 honestly don't like disclosing too much information about my system, in this case which MUA I'm using and its version.

Cheers,
-- 
Luís

> Signed-off-by: Luis Henriques <henrix@camandro.org>
> ---
>  Documentation/config.txt         |  1 +
>  Documentation/git-send-email.txt |  3 +++
>  git-send-email.perl              | 12 ++++++++++--
>  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 73c8973..c33d5a1 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2222,6 +2222,7 @@ sendemail.smtpserveroption::
>  sendemail.smtpuser::
>  sendemail.thread::
>  sendemail.validate::
> +sendemail.xmailer::
>  	See linkgit:git-send-email[1] for description.
>  
>  sendemail.signedoffcc::
> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
> index f0e57a5..fab6264 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -131,6 +131,9 @@ Note that no attempts whatsoever are made to validate the encoding.
>  	Specify encoding of compose message. Default is the value of the
>  	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
>  
> +--xmailer::
> +	Prevent adding the "X-Mailer:" header.  Default value is
> +	'sendemail.xmailer'.
>  
>  Sending
>  ~~~~~~~
> diff --git a/git-send-email.perl b/git-send-email.perl
> index fdb0029..8789124 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
>      --[no-]bcc              <str>  * Email Bcc:
>      --subject               <str>  * Email "Subject:"
>      --in-reply-to           <str>  * Email "In-Reply-To:"
> +    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
>      --[no-]annotate                * Review each patch that will be sent in an editor.
>      --compose                      * Open an editor for introduction.
>      --compose-encoding      <str>  * Encoding to assume for introduction.
> @@ -174,6 +175,9 @@ my $force = 0;
>  my $multiedit;
>  my $editor;
>  
> +# Usage of X-Mailer email header
> +my $xmailer;
> +
>  sub do_edit {
>  	if (!defined($editor)) {
>  		$editor = Git::command_oneline('var', 'GIT_EDITOR');
> @@ -214,7 +218,8 @@ my %config_bool_settings = (
>      "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
>      "validate" => [\$validate, 1],
>      "multiedit" => [\$multiedit, undef],
> -    "annotate" => [\$annotate, undef]
> +    "annotate" => [\$annotate, undef],
> +    "xmailer" => [\$xmailer, 1]
>  );
>  
>  my %config_settings = (
> @@ -311,6 +316,7 @@ my $rc = GetOptions("h" => \$help,
>  		    "8bit-encoding=s" => \$auto_8bit_encoding,
>  		    "compose-encoding=s" => \$compose_encoding,
>  		    "force" => \$force,
> +		    "xmailer!" => \$xmailer,
>  	 );
>  
>  usage() if $help;
> @@ -1144,8 +1150,10 @@ To: $to${ccline}
>  Subject: $subject
>  Date: $date
>  Message-Id: $message_id
> -X-Mailer: git-send-email $gitversion
>  ";
> +	if ($xmailer) {
> +		$header .= "X-Mailer: git-send-email $gitversion\n";
> +	}
>  	if ($reply_to) {
>  
>  		$header .= "In-Reply-To: $reply_to\n";
> -- 
> 1.9.1
Eric Wong· Dec 3, 2014, 02:34 UTC · re: Luis Henriques · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Luis Henriques <henrix@camandro.org> wrote:
Show 9 quoted lines
> 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.

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.

Kyle J. McKay· Dec 3, 2014, 03:22 UTC · re: Eric Wong · lore

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.
I fully agree with you.
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:
Show changes to 2 files +4 −2

git-send-email.orig, git-send-email.new

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
Luis Henriques· Dec 3, 2014, 10:13 UTC · re: Kyle J. McKay · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

On Tue, Dec 02, 2014 at 07:22:10PM -0800, Kyle J. McKay wrote:
Show 31 quoted lines
> On Dec 2, 2014, at 18:34, Eric Wong wrote:
> 
> >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.
> 
> I fully agree with you.
> 
> >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:
Awesome, I like this idea too!
Cheers,
-- 
Luís

> 
> 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
Junio C Hamano· Dec 3, 2014, 16:56 UTC · re: Eric Wong · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Eric Wong <normalperson@yhbt.net> writes:
Show 25 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.
>
> 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.
I actually do not think this is a good idea from debuggability.
Luis Henriques· Dec 4, 2014, 19:22 UTC · re: Junio C Hamano · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

On Wed, Dec 03, 2014 at 08:56:45AM -0800, Junio C Hamano wrote:
Show 29 quoted lines
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > 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.
> >
> > 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.
> 
> I actually do not think this is a good idea from debuggability.

Do you think this could be merged with yet another switch? I can't think of a name for the switch, something like... "--hide-msgid"?

Another option would be to re-work the --no-xmailer switch to change it into a "--hide-id" (or something), where both the "X-Mailer:" header would be dropped and the Message-id would be obfuscated.

Cheers,
-- 
Luís
Junio C Hamano· Dec 4, 2014, 19:33 UTC · re: Luis Henriques · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Luis Henriques <henrix@camandro.org> writes:
Show 6 quoted lines
> On Wed, Dec 03, 2014 at 08:56:45AM -0800, Junio C Hamano wrote:
>
>> I actually do not think this is a good idea from debuggability.
>
> Do you think this could be merged with yet another switch?  I can't
> think of a name for the switch, something like... "--hide-msgid"?

In case it wasn't clear, by "this" I meant the removal of "X-Mailer:", iow, "Adding --no-xmailer option is a bad idea from debuggability's point of view".

Not adding message-id is not an option; MSAs are supposed to always add one if they want to be RFC compliant, aren't they?

Luis Henriques· Dec 4, 2014, 19:44 UTC · re: Junio C Hamano · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

On Thu, Dec 04, 2014 at 11:33:24AM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> Luis Henriques <henrix@camandro.org> writes:
> 
> > On Wed, Dec 03, 2014 at 08:56:45AM -0800, Junio C Hamano wrote:
> >
> >> I actually do not think this is a good idea from debuggability.
> >
> > Do you think this could be merged with yet another switch?  I can't
> > think of a name for the switch, something like... "--hide-msgid"?
> 
> In case it wasn't clear, by "this" I meant the removal of
> "X-Mailer:", iow, "Adding --no-xmailer option is a bad idea from
> debuggability's point of view".
>
Oh, ok.  I thought you were talking about the message-id.
> Not adding message-id is not an option; MSAs are supposed to always
> add one if they want to be RFC compliant, aren't they?

Yes, of course -- having a message ID is a requirement. But I was hoping you could accept a solution similar to the one suggested by Kyle (adding him to Cc): he was suggesting hashing the message ID, which would be a good compromise, I believe.

Cheers,
-- 
Luís
Junio C Hamano· Dec 3, 2014, 17:08 UTC · re: Luis Henriques · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Luis Henriques <henrix@camandro.org> writes:
> +--xmailer::
> +	Prevent adding the "X-Mailer:" header.  Default value is
> +	'sendemail.xmailer'.
Two problems here.
 - "git send-email --xmailer" would _ADD_, not prevent adding, the
   header, regardless of the value of sendemail.xmailer.
 - It is unspecified what happens when you do not have
   sendemail.xmailer and do not give the --xmailer option.
Perhaps

--xmailer:: --no-xmailer::

	By default, `git send-email` adds an "X-Mailer:" header to
        the message to identify the version of itself.  The
        `--no-xmailer` option can be used to turn this off (setting
        the `sendemail.xmailer` configuration to false has the same
        effect).  The `--xmailer` option from the command line is
        useful to countermand `sendemail.xmailer` that is set to
        `false`.
or something?
Show 9 quoted lines
> diff --git a/git-send-email.perl b/git-send-email.perl
> index fdb0029..8789124 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
>      --[no-]bcc              <str>  * Email Bcc:
>      --subject               <str>  * Email "Subject:"
>      --in-reply-to           <str>  * Email "In-Reply-To:"
> +    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.

The same confusion exists here. "Don't ... default on" hints that by default we won't see "X-mailer:" which is not true.

A way to avoid confusion is to describe what the option is about for the positive variant, just like it is done for "--[no-]annotate" option below.

Show 40 quoted lines
> @@ -174,6 +175,9 @@ my $force = 0;
>  my $multiedit;
>  my $editor;
>  
> +# Usage of X-Mailer email header
> +my $xmailer;
> +
>  sub do_edit {
>  	if (!defined($editor)) {
>  		$editor = Git::command_oneline('var', 'GIT_EDITOR');
> @@ -214,7 +218,8 @@ my %config_bool_settings = (
>      "signedoffcc" => [\$signed_off_by_cc, undef],      # Deprecated
>      "validate" => [\$validate, 1],
>      "multiedit" => [\$multiedit, undef],
> -    "annotate" => [\$annotate, undef]
> +    "annotate" => [\$annotate, undef],
> +    "xmailer" => [\$xmailer, 1]
>  );
>  
>  my %config_settings = (
> @@ -311,6 +316,7 @@ my $rc = GetOptions("h" => \$help,
>  		    "8bit-encoding=s" => \$auto_8bit_encoding,
>  		    "compose-encoding=s" => \$compose_encoding,
>  		    "force" => \$force,
> +		    "xmailer!" => \$xmailer,
>  	 );
>  
>  usage() if $help;
> @@ -1144,8 +1150,10 @@ To: $to${ccline}
>  Subject: $subject
>  Date: $date
>  Message-Id: $message_id
> -X-Mailer: git-send-email $gitversion
>  ";
> +	if ($xmailer) {
> +		$header .= "X-Mailer: git-send-email $gitversion\n";
> +	}
>  	if ($reply_to) {
>  
>  		$header .= "In-Reply-To: $reply_to\n";
tests?
Thanks.
Junio C Hamano· Dec 3, 2014, 17:23 UTC · re: Junio C Hamano · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Junio C Hamano <gitster@pobox.com> writes:
> Two problems here.
> ...
> tests?

Something like this squashed into the patch you posted earlier, perhaps, would be a good place to start.

 Documentation/git-send-email.txt |  6 ++++--
 git-send-email.perl              | 11 +++++------
 2 files changed, 9 insertions(+), 8 deletions(-)
Show changes to 2 files +9 −8

Documentation/git-send-email.txt, git-send-email.perl

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index f2425ef..a0bd806 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -132,8 +132,10 @@ Note that no attempts whatsoever are made to validate the encoding.
 	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
 
 --xmailer::
-	Prevent adding the "X-Mailer:" header.  Default value is
-	'sendemail.xmailer'.
+--no-xmailer::
+	Add (or prevent adding) the "X-Mailer:" header.  By default,
+	the header is added, but it can be turned off by setting the
+	`sendemail.xmailer` configuration variable to `false`.
 
 Sending
 ~~~~~~~
diff --git a/git-send-email.perl b/git-send-email.perl
index 9ca7c5b..a6e66b9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -54,7 +54,7 @@ sub usage {
     --[no-]bcc              <str>  * Email Bcc:
     --subject               <str>  * Email "Subject:"
     --in-reply-to           <str>  * Email "In-Reply-To:"
-    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
+    --[no-]xmailer                 * Add "X-Mailer:" header (default).
     --[no-]annotate                * Review each patch that will be sent in an editor.
     --compose                      * Open an editor for introduction.
     --compose-encoding      <str>  * Encoding to assume for introduction.
@@ -177,8 +177,7 @@ sub format_2822_time {
 my $multiedit;
 my $editor;
 
-# Usage of X-Mailer email header
-my $xmailer;
+my $use_xmailer;
 
 sub do_edit {
 	if (!defined($editor)) {
@@ -224,7 +223,7 @@ sub do_edit {
     "validate" => [\$validate, 1],
     "multiedit" => [\$multiedit, undef],
     "annotate" => [\$annotate, undef],
-    "xmailer" => [\$xmailer, 1]
+    "xmailer" => [\$use_xmailer, 1]
 );
 
 my %config_settings = (
@@ -323,7 +322,7 @@ sub signal_handler {
 		    "8bit-encoding=s" => \$auto_8bit_encoding,
 		    "compose-encoding=s" => \$compose_encoding,
 		    "force" => \$force,
-		    "xmailer!" => \$xmailer,
+		    "xmailer!" => \$use_xmailer,
 	 );
 
 usage() if $help;
@@ -1170,7 +1169,7 @@ sub send_message {
 Date: $date
 Message-Id: $message_id
 ";
-	if ($xmailer) {
+	if ($use_xmailer) {
 		$header .= "X-Mailer: git-send-email $gitversion\n";
 	}
 	if ($reply_to) {
-- 
2.2.0-141-gd3f4719
Junio C Hamano· Dec 3, 2014, 17:39 UTC · re: Junio C Hamano · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> @@ -177,8 +177,7 @@ sub format_2822_time {
>  my $multiedit;
>  my $editor;
>  
> -# Usage of X-Mailer email header
> -my $xmailer;
> +my $use_xmailer;

Just another small thing. The version of "SQUASH???" commit I will queue on 'pu' will have this next to where $annotate is defined.

Luis Henriques· Dec 3, 2014, 18:02 UTC · re: Junio C Hamano · lore

Re: [RFC][PATCH] send-email: add --[no-]xmailer option

On Wed, Dec 03, 2014 at 09:23:11AM -0800, Junio C Hamano wrote:
Show 9 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Two problems here.
> > ...
> > tests?
> 
> Something like this squashed into the patch you posted earlier,
> perhaps, would be a good place to start.
>

Awesome, thank you for your review. I'll post a new version of the patch including your suggestions. Regarding the tests, I'll need a bit more time to work on those.

Cheers,
-- 
Luís


>  Documentation/git-send-email.txt |  6 ++++--
>  git-send-email.perl              | 11 +++++------
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
> index f2425ef..a0bd806 100644
> --- a/Documentation/git-send-email.txt
> +++ b/Documentation/git-send-email.txt
> @@ -132,8 +132,10 @@ Note that no attempts whatsoever are made to validate the encoding.
>  	'sendemail.composeencoding'; if that is unspecified, UTF-8 is assumed.
>  
>  --xmailer::
> -	Prevent adding the "X-Mailer:" header.  Default value is
> -	'sendemail.xmailer'.
> +--no-xmailer::
> +	Add (or prevent adding) the "X-Mailer:" header.  By default,
> +	the header is added, but it can be turned off by setting the
> +	`sendemail.xmailer` configuration variable to `false`.
>  
>  Sending
>  ~~~~~~~
> diff --git a/git-send-email.perl b/git-send-email.perl
> index 9ca7c5b..a6e66b9 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -54,7 +54,7 @@ sub usage {
>      --[no-]bcc              <str>  * Email Bcc:
>      --subject               <str>  * Email "Subject:"
>      --in-reply-to           <str>  * Email "In-Reply-To:"
> -    --[no-]xmailer                 * Don't add "X-Mailer:" header.  Default on.
> +    --[no-]xmailer                 * Add "X-Mailer:" header (default).
>      --[no-]annotate                * Review each patch that will be sent in an editor.
>      --compose                      * Open an editor for introduction.
>      --compose-encoding      <str>  * Encoding to assume for introduction.
> @@ -177,8 +177,7 @@ sub format_2822_time {
>  my $multiedit;
>  my $editor;
>  
> -# Usage of X-Mailer email header
> -my $xmailer;
> +my $use_xmailer;
>  
>  sub do_edit {
>  	if (!defined($editor)) {
> @@ -224,7 +223,7 @@ sub do_edit {
>      "validate" => [\$validate, 1],
>      "multiedit" => [\$multiedit, undef],
>      "annotate" => [\$annotate, undef],
> -    "xmailer" => [\$xmailer, 1]
> +    "xmailer" => [\$use_xmailer, 1]
>  );
>  
>  my %config_settings = (
> @@ -323,7 +322,7 @@ sub signal_handler {
>  		    "8bit-encoding=s" => \$auto_8bit_encoding,
>  		    "compose-encoding=s" => \$compose_encoding,
>  		    "force" => \$force,
> -		    "xmailer!" => \$xmailer,
> +		    "xmailer!" => \$use_xmailer,
>  	 );
>  
>  usage() if $help;
> @@ -1170,7 +1169,7 @@ sub send_message {
>  Date: $date
>  Message-Id: $message_id
>  ";
> -	if ($xmailer) {
> +	if ($use_xmailer) {
>  		$header .= "X-Mailer: git-send-email $gitversion\n";
>  	}
>  	if ($reply_to) {
> -- 
> 2.2.0-141-gd3f4719
> 

← back to recent threads