mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
Merge branch 'lh/send-email-hide-x-mailer'
"git send-email" normally identifies itself via X-Mailer: header in the message it sends out. A new command line flag allows the user to squelch the header. * lh/send-email-hide-x-mailer: test/send-email: --[no-]xmailer tests send-email: add --[no-]xmailer option
This commit is contained in:
commit
5095fa61e3
@ -2329,6 +2329,7 @@ sendemail.smtpuser::
|
|||||||
sendemail.thread::
|
sendemail.thread::
|
||||||
sendemail.transferencoding::
|
sendemail.transferencoding::
|
||||||
sendemail.validate::
|
sendemail.validate::
|
||||||
|
sendemail.xmailer::
|
||||||
See linkgit:git-send-email[1] for description.
|
See linkgit:git-send-email[1] for description.
|
||||||
|
|
||||||
sendemail.signedoffcc::
|
sendemail.signedoffcc::
|
||||||
|
@ -141,6 +141,11 @@ Note that no attempts whatsoever are made to validate the encoding.
|
|||||||
configuration value; if that is unspecified, git will use 8bit and not
|
configuration value; if that is unspecified, git will use 8bit and not
|
||||||
add a Content-Transfer-Encoding header.
|
add a Content-Transfer-Encoding header.
|
||||||
|
|
||||||
|
--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
|
Sending
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -54,6 +54,7 @@ git send-email [options] <file | directory | rev-list options >
|
|||||||
--[no-]bcc <str> * Email Bcc:
|
--[no-]bcc <str> * Email Bcc:
|
||||||
--subject <str> * Email "Subject:"
|
--subject <str> * Email "Subject:"
|
||||||
--in-reply-to <str> * Email "In-Reply-To:"
|
--in-reply-to <str> * Email "In-Reply-To:"
|
||||||
|
--[no-]xmailer * Add "X-Mailer:" header (default).
|
||||||
--[no-]annotate * Review each patch that will be sent in an editor.
|
--[no-]annotate * Review each patch that will be sent in an editor.
|
||||||
--compose * Open an editor for introduction.
|
--compose * Open an editor for introduction.
|
||||||
--compose-encoding <str> * Encoding to assume for introduction.
|
--compose-encoding <str> * Encoding to assume for introduction.
|
||||||
@ -154,7 +155,7 @@ my $re_encoded_word = qr/=\?($re_token)\?($re_token)\?($re_encoded_text)\?=/;
|
|||||||
# Variables we fill in automatically, or via prompting:
|
# Variables we fill in automatically, or via prompting:
|
||||||
my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
|
my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
|
||||||
$initial_reply_to,$initial_subject,@files,
|
$initial_reply_to,$initial_subject,@files,
|
||||||
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
|
$author,$sender,$smtp_authpass,$annotate,$use_xmailer,$compose,$time);
|
||||||
|
|
||||||
my $envelope_sender;
|
my $envelope_sender;
|
||||||
|
|
||||||
@ -226,7 +227,8 @@ my %config_bool_settings = (
|
|||||||
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
|
"signedoffcc" => [\$signed_off_by_cc, undef], # Deprecated
|
||||||
"validate" => [\$validate, 1],
|
"validate" => [\$validate, 1],
|
||||||
"multiedit" => [\$multiedit, undef],
|
"multiedit" => [\$multiedit, undef],
|
||||||
"annotate" => [\$annotate, undef]
|
"annotate" => [\$annotate, undef],
|
||||||
|
"xmailer" => [\$use_xmailer, 1]
|
||||||
);
|
);
|
||||||
|
|
||||||
my %config_settings = (
|
my %config_settings = (
|
||||||
@ -327,6 +329,7 @@ my $rc = GetOptions("h" => \$help,
|
|||||||
"8bit-encoding=s" => \$auto_8bit_encoding,
|
"8bit-encoding=s" => \$auto_8bit_encoding,
|
||||||
"compose-encoding=s" => \$compose_encoding,
|
"compose-encoding=s" => \$compose_encoding,
|
||||||
"force" => \$force,
|
"force" => \$force,
|
||||||
|
"xmailer!" => \$use_xmailer,
|
||||||
);
|
);
|
||||||
|
|
||||||
usage() if $help;
|
usage() if $help;
|
||||||
@ -1181,8 +1184,10 @@ To: $to${ccline}
|
|||||||
Subject: $subject
|
Subject: $subject
|
||||||
Date: $date
|
Date: $date
|
||||||
Message-Id: $message_id
|
Message-Id: $message_id
|
||||||
X-Mailer: git-send-email $gitversion
|
|
||||||
";
|
";
|
||||||
|
if ($use_xmailer) {
|
||||||
|
$header .= "X-Mailer: git-send-email $gitversion\n";
|
||||||
|
}
|
||||||
if ($reply_to) {
|
if ($reply_to) {
|
||||||
|
|
||||||
$header .= "In-Reply-To: $reply_to\n";
|
$header .= "In-Reply-To: $reply_to\n";
|
||||||
|
@ -1564,4 +1564,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
|
|||||||
grep "^!someone@example\.org!$" commandline1
|
grep "^!someone@example\.org!$" commandline1
|
||||||
'
|
'
|
||||||
|
|
||||||
|
do_xmailer_test () {
|
||||||
|
expected=$1 params=$2 &&
|
||||||
|
git format-patch -1 &&
|
||||||
|
git send-email \
|
||||||
|
--from="Example <nobody@example.com>" \
|
||||||
|
--to=someone@example.com \
|
||||||
|
--smtp-server="$(pwd)/fake.sendmail" \
|
||||||
|
$params \
|
||||||
|
0001-*.patch \
|
||||||
|
2>errors >out &&
|
||||||
|
{ grep '^X-Mailer:' out || :; } >mailer &&
|
||||||
|
test_line_count = $expected mailer
|
||||||
|
}
|
||||||
|
|
||||||
|
test_expect_success $PREREQ '--[no-]xmailer without any configuration' '
|
||||||
|
do_xmailer_test 1 "--xmailer" &&
|
||||||
|
do_xmailer_test 0 "--no-xmailer"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
|
||||||
|
test_config sendemail.xmailer true &&
|
||||||
|
do_xmailer_test 1 "" &&
|
||||||
|
do_xmailer_test 0 "--no-xmailer" &&
|
||||||
|
do_xmailer_test 1 "--xmailer"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
|
||||||
|
test_config sendemail.xmailer false &&
|
||||||
|
do_xmailer_test 0 "" &&
|
||||||
|
do_xmailer_test 0 "--no-xmailer" &&
|
||||||
|
do_xmailer_test 1 "--xmailer"
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user