mirror of
https://github.com/git/git.git
synced 2024-05-18 17:06:07 +02:00
git-send-email: make options easier to configure.
This change makes git-send-email's behavior easier to modify by adding config equivalents for two more of git-send-email's flags. The mapping of flag to config setting is: --[no-]supress-from => sendemail.suppressfrom --[no-]signed-off-cc => sendemail.signedoffcc It renames the --threaded option to --thread/--no-thread; the config variable is also called sendemail.thread. Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
fe5e7f332c
commit
5483c71d7a
|
@ -59,9 +59,11 @@ The --cc option must be repeated for each user you want on the cc list.
|
||||||
Only necessary if --compose is also set. If --compose
|
Only necessary if --compose is also set. If --compose
|
||||||
is not set, this will be prompted for.
|
is not set, this will be prompted for.
|
||||||
|
|
||||||
--no-signed-off-by-cc::
|
--signed-off-by-cc, --no-signed-off-by-cc::
|
||||||
Do not add emails found in Signed-off-by: or Cc: lines to the
|
If this is set, add emails found in Signed-off-by: or Cc: lines to the
|
||||||
cc list.
|
cc list.
|
||||||
|
Default is the value of 'sendemail.signedoffbycc' configuration value;
|
||||||
|
if that is unspecified, default to --signed-off-by-cc.
|
||||||
|
|
||||||
--quiet::
|
--quiet::
|
||||||
Make git-send-email less verbose. One line per email should be
|
Make git-send-email less verbose. One line per email should be
|
||||||
|
@ -82,16 +84,18 @@ The --cc option must be repeated for each user you want on the cc list.
|
||||||
Only necessary if --compose is also set. If --compose
|
Only necessary if --compose is also set. If --compose
|
||||||
is not set, this will be prompted for.
|
is not set, this will be prompted for.
|
||||||
|
|
||||||
--suppress-from::
|
--suppress-from, --no-suppress-from::
|
||||||
Do not add the From: address to the cc: list, if it shows up in a From:
|
If this is set, do not add the From: address to the cc: list, if it
|
||||||
line.
|
shows up in a From: line.
|
||||||
|
Default is the value of 'sendemail.suppressfrom' configuration value;
|
||||||
|
if that is unspecified, default to --no-supress-from.
|
||||||
|
|
||||||
--threaded, --no-threaded::
|
--thread, --no-thread::
|
||||||
If this is set, the In-Reply-To header will be set on each email sent.
|
If this is set, the In-Reply-To header will be set on each email sent.
|
||||||
If disabled with "--no-threaded", no emails will have the In-Reply-To
|
If disabled with "--no-thread", no emails will have the In-Reply-To
|
||||||
header set.
|
header set.
|
||||||
Default is the value of the 'sendemail.threaded' configuration value;
|
Default is the value of the 'sendemail.thread' configuration value;
|
||||||
if that is unspecified, default to --threaded.
|
if that is unspecified, default to --thread.
|
||||||
|
|
||||||
--dry-run::
|
--dry-run::
|
||||||
Do everything except actually send the emails.
|
Do everything except actually send the emails.
|
||||||
|
|
|
@ -64,17 +64,16 @@ sub usage {
|
||||||
email sent, rather than to the first email sent.
|
email sent, rather than to the first email sent.
|
||||||
Defaults to on.
|
Defaults to on.
|
||||||
|
|
||||||
--no-signed-off-cc Suppress the automatic addition of email addresses
|
--signed-off-cc Automatically add email addresses that appear in
|
||||||
that appear in Signed-off-by: or Cc: lines to the cc:
|
Signed-off-by: or Cc: lines to the cc: list. Defaults to on.
|
||||||
list. Note: Using this option is not recommended.
|
|
||||||
|
|
||||||
--smtp-server If set, specifies the outgoing SMTP server to use.
|
--smtp-server If set, specifies the outgoing SMTP server to use.
|
||||||
Defaults to localhost.
|
Defaults to localhost.
|
||||||
|
|
||||||
--suppress-from Suppress sending emails to yourself if your address
|
--suppress-from Suppress sending emails to yourself if your address
|
||||||
appears in a From: line.
|
appears in a From: line. Defaults to off.
|
||||||
|
|
||||||
--threaded Specify that the "In-Reply-To:" header should be set on all
|
--thread Specify that the "In-Reply-To:" header should be set on all
|
||||||
emails. Defaults to on.
|
emails. Defaults to on.
|
||||||
|
|
||||||
--quiet Make git-send-email less verbose. One line per email
|
--quiet Make git-send-email less verbose. One line per email
|
||||||
|
@ -140,9 +139,6 @@ sub format_2822_time {
|
||||||
my (@to,@cc,@initial_cc,@bcclist,@xh,
|
my (@to,@cc,@initial_cc,@bcclist,@xh,
|
||||||
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
|
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
|
||||||
|
|
||||||
# Behavior modification variables
|
|
||||||
my ($threaded, $chain_reply_to, $quiet, $suppress_from, $no_signed_off_cc,
|
|
||||||
$dry_run) = (1, 1, 0, 0, 0, 0);
|
|
||||||
my $smtp_server;
|
my $smtp_server;
|
||||||
my $envelope_sender;
|
my $envelope_sender;
|
||||||
|
|
||||||
|
@ -157,16 +153,22 @@ sub format_2822_time {
|
||||||
$term = new FakeTerm "$@: going non-interactive";
|
$term = new FakeTerm "$@: going non-interactive";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Behavior modification variables
|
||||||
|
my ($quiet, $dry_run) = (0, 0);
|
||||||
|
|
||||||
|
# Variables with corresponding config settings
|
||||||
|
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);
|
||||||
|
|
||||||
my %config_settings = (
|
my %config_settings = (
|
||||||
"threaded" => \$threaded,
|
"thread" => [\$thread, 1],
|
||||||
"chainreplyto" => \$chain_reply_to,
|
"chainreplyto" => [\$chain_reply_to, 1],
|
||||||
|
"suppressfrom" => [\$suppress_from, 0],
|
||||||
|
"signedoffcc" => [\$signed_off_cc, 1],
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach my $setting (keys %config_settings) {
|
foreach my $setting (keys %config_settings) {
|
||||||
my $default = $repo->config_bool("sendemail.$setting");
|
my $config = $repo->config_bool("sendemail.$setting");
|
||||||
if (defined $default) {
|
${$config_settings{$setting}->[0]} = (defined $config) ? $config : $config_settings{$setting}->[1];
|
||||||
$config_settings{$setting} = $default ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@bcclist = $repo->config('sendemail.bcc');
|
@bcclist = $repo->config('sendemail.bcc');
|
||||||
|
@ -187,11 +189,11 @@ sub format_2822_time {
|
||||||
"smtp-server=s" => \$smtp_server,
|
"smtp-server=s" => \$smtp_server,
|
||||||
"compose" => \$compose,
|
"compose" => \$compose,
|
||||||
"quiet" => \$quiet,
|
"quiet" => \$quiet,
|
||||||
"suppress-from" => \$suppress_from,
|
"suppress-from!" => \$suppress_from,
|
||||||
"no-signed-off-cc|no-signed-off-by-cc" => \$no_signed_off_cc,
|
"signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
|
||||||
"dry-run" => \$dry_run,
|
"dry-run" => \$dry_run,
|
||||||
"envelope-sender=s" => \$envelope_sender,
|
"envelope-sender=s" => \$envelope_sender,
|
||||||
"threaded!" => \$threaded,
|
"thread!" => \$thread,
|
||||||
);
|
);
|
||||||
|
|
||||||
unless ($rc) {
|
unless ($rc) {
|
||||||
|
@ -298,7 +300,7 @@ sub expand_aliases {
|
||||||
$prompting++;
|
$prompting++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($threaded && !defined $initial_reply_to && $prompting) {
|
if ($thread && !defined $initial_reply_to && $prompting) {
|
||||||
do {
|
do {
|
||||||
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
|
$_= $term->readline("Message-ID to be used as In-Reply-To for the first email? ",
|
||||||
$initial_reply_to);
|
$initial_reply_to);
|
||||||
|
@ -495,7 +497,7 @@ sub send_message
|
||||||
Message-Id: $message_id
|
Message-Id: $message_id
|
||||||
X-Mailer: git-send-email $gitversion
|
X-Mailer: git-send-email $gitversion
|
||||||
";
|
";
|
||||||
if ($threaded && $reply_to) {
|
if ($thread && $reply_to) {
|
||||||
|
|
||||||
$header .= "In-Reply-To: $reply_to\n";
|
$header .= "In-Reply-To: $reply_to\n";
|
||||||
$header .= "References: $references\n";
|
$header .= "References: $references\n";
|
||||||
|
@ -620,7 +622,7 @@ sub send_message
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message .= $_;
|
$message .= $_;
|
||||||
if (/^(Signed-off-by|Cc): (.*)$/i && !$no_signed_off_cc) {
|
if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
|
||||||
my $c = $2;
|
my $c = $2;
|
||||||
chomp $c;
|
chomp $c;
|
||||||
push @cc, $c;
|
push @cc, $c;
|
||||||
|
|
Loading…
Reference in New Issue