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

From: Luis Henriques <[email-masked]>
Date: Wed, 3 Dec 2014 18:02:48 +0000

On Wed, Dec 03, 2014 at 09:23:11AM -0800, Junio C Hamano wrote:
> Junio C Hamano <[email-masked]> 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
>