1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-18 15:04:49 +01:00

Merge branch 'ra/email'

* ra/email:
  send-email: Add --cc
  send-email: Add some options for controlling how addresses are automatically added to the cc: list.
This commit is contained in:
Junio C Hamano 2006-02-13 02:38:57 -08:00
commit 45dcab31ee
2 changed files with 28 additions and 5 deletions

View file

@ -24,6 +24,9 @@ OPTIONS
------- -------
The options available are: The options available are:
--cc::
Specify a starting "Cc:" value for each email.
--chain-reply-to, --no-chain-reply-to:: --chain-reply-to, --no-chain-reply-to::
If this is set, each email will be sent as a reply to the previous If this is set, each email will be sent as a reply to the previous
email sent. If disabled with "--no-chain-reply-to", all emails after email sent. If disabled with "--no-chain-reply-to", all emails after
@ -48,6 +51,9 @@ The options available are:
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::
Do not add emails foudn in Signed-off-by: lines to the cc list.
--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
all that is output. all that is output.
@ -61,6 +67,10 @@ The options available are:
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::
Do not add the From: address to the cc: list, if it shows up in a From:
line.
--to:: --to::
Specify the primary recipient of the emails generated. Specify the primary recipient of the emails generated.
Generally, this will be the upstream maintainer of the Generally, this will be the upstream maintainer of the

View file

@ -31,10 +31,10 @@
my $compose_filename = ".msg.$$"; my $compose_filename = ".msg.$$";
# Variables we fill in automatically, or via prompting: # Variables we fill in automatically, or via prompting:
my (@to,@cc,$initial_reply_to,$initial_subject,@files,$from,$compose); my (@to,@cc,@initial_cc,$initial_reply_to,$initial_subject,@files,$from,$compose);
# Behavior modification variables # Behavior modification variables
my ($chain_reply_to, $smtp_server, $quiet) = (1, "localhost", 0); my ($chain_reply_to, $smtp_server, $quiet, $suppress_from, $no_signed_off_cc) = (1, "localhost", 0, 0, 0);
# Example reply to: # Example reply to:
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>'; #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@ -48,10 +48,13 @@
"in-reply-to=s" => \$initial_reply_to, "in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject, "subject=s" => \$initial_subject,
"to=s" => \@to, "to=s" => \@to,
"cc=s" => \@initial_cc,
"chain-reply-to!" => \$chain_reply_to, "chain-reply-to!" => \$chain_reply_to,
"smtp-server=s" => \$smtp_server, "smtp-server=s" => \$smtp_server,
"compose" => \$compose, "compose" => \$compose,
"quiet" => \$quiet, "quiet" => \$quiet,
"suppress-from" => \$suppress_from,
"no-signed-off-cc" => \$no_signed_off_cc,
); );
# Now, let's fill any that aren't set in with defaults: # Now, let's fill any that aren't set in with defaults:
@ -197,6 +200,9 @@
--to Specify the primary "To:" line of the email. --to Specify the primary "To:" line of the email.
--cc Specify an initial "Cc:" list for the entire series
of emails.
--compose Use \$EDITOR to edit an introductory message for the --compose Use \$EDITOR to edit an introductory message for the
patch series. patch series.
@ -212,13 +218,19 @@
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
that appear in a Signed-off-by: line, to the cc: 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 Supress sending emails to yourself if your address
appears in a From: line.
--quiet Make git-send-email less verbose. One line per email should be --quiet Make git-send-email less verbose. One line per email should be
all that is output. all that is output.
Error: Please specify a file or a directory on the command line. Error: Please specify a file or a directory on the command line.
EOT EOT
exit(1); exit(1);
@ -290,7 +302,7 @@ sub send_message
foreach my $t (@files) { foreach my $t (@files) {
open(F,"<",$t) or die "can't open file $t"; open(F,"<",$t) or die "can't open file $t";
@cc = (); @cc = @initial_cc;
my $found_mbox = 0; my $found_mbox = 0;
my $header_done = 0; my $header_done = 0;
$message = ""; $message = "";
@ -304,6 +316,7 @@ sub send_message
$subject = $1; $subject = $1;
} elsif (/^(Cc|From):\s+(.*)$/) { } elsif (/^(Cc|From):\s+(.*)$/) {
next if ($2 eq $from && $suppress_from);
printf("(mbox) Adding cc: %s from line '%s'\n", printf("(mbox) Adding cc: %s from line '%s'\n",
$2, $_) unless $quiet; $2, $_) unless $quiet;
push @cc, $2; push @cc, $2;
@ -332,7 +345,7 @@ sub send_message
} }
} else { } else {
$message .= $_; $message .= $_;
if (/^Signed-off-by: (.*)$/i) { if (/^Signed-off-by: (.*)$/i && !$no_signed_off_cc) {
my $c = $1; my $c = $1;
chomp $c; chomp $c;
push @cc, $c; push @cc, $c;