git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2014, 17:23 UTC
Message-ID
<xmqq388wk5q8.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqfvcwk6en.fsf@gitster.dls.corp.google.com>
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(-)
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 13 in “send-email: add --[no-]xmailer option”
  1. Luis HenriquesMar 24, 2014
  2. Luis HenriquesDec 2, 2014
  3. Eric WongDec 3, 2014
  4. Kyle J. McKayDec 3, 2014
  5. Luis HenriquesDec 3, 2014
  6. Junio C HamanoDec 3, 2014
  7. Luis HenriquesDec 4, 2014
  8. Junio C HamanoDec 4, 2014
  9. Luis HenriquesDec 4, 2014
  10. Junio C HamanoDec 3, 2014
  11. Junio C HamanoDec 3, 2014
  12. Junio C HamanoDec 3, 2014
  13. Luis HenriquesDec 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.