diff --git a/git-send-email.perl b/git-send-email.perl
index ec1428d961206f12e195274aea6ea3ae52374898..13b85dddd186b5b769fb8e9b88896b1f89ef7935 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
my $compose_filename = ".msg.$$";
# Variables we fill in automatically, or via prompting:
my $compose_filename = ".msg.$$";
# 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) = (1, "localhost");
+my ($chain_reply_to, $smtp_server, $quiet, $suppress_from, $no_signed_off_cc) = (1, "localhost", 0, 0, 0);
# Example reply to:
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
# Example reply to:
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
"to=s" => \@to,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
"to=s" => \@to,
+ "cc=s" => \@initial_cc,
"chain-reply-to!" => \$chain_reply_to,
"smtp-server=s" => \$smtp_server,
"compose" => \$compose,
"chain-reply-to!" => \$chain_reply_to,
"smtp-server=s" => \$smtp_server,
"compose" => \$compose,
+ "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:
# effort to have it be unique
open(C,">",$compose_filename)
or die "Failed to open for writing $compose_filename: $!";
# effort to have it be unique
open(C,">",$compose_filename)
or die "Failed to open for writing $compose_filename: $!";
- print C "From \n";
+ print C "From $from # This line is ignored.\n";
printf C "Subject: %s\n\n", $initial_subject;
printf C <<EOT;
GIT: Please enter your email below.
printf C "Subject: %s\n\n", $initial_subject;
printf C <<EOT;
GIT: Please enter your email below.
}
if (@files) {
}
if (@files) {
- print $_,"\n" for @files;
+ unless ($quiet) {
+ print $_,"\n" for (@files);
+ }
} else {
print <<EOT;
git-send-email [options] <file | directory> [... file | directory ]
} else {
print <<EOT;
git-send-email [options] <file | directory> [... file | directory ]
--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
patch series.
--compose Use \$EDITOR to edit an introductory message for the
patch series.
email sent, rather than to the first email sent.
Defaults to on.
email sent, rather than to the first email sent.
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.
Defaults to localhost.
--smtp-server If set, specifies the outgoing SMTP server to use.
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
+ all that is output.
+
Error: Please specify a file or a directory on the command line.
EOT
exit(1);
Error: Please specify a file or a directory on the command line.
EOT
exit(1);
sendmail(%mail) or die $Mail::Sendmail::error;
sendmail(%mail) or die $Mail::Sendmail::error;
- print "OK. Log says:\n", $Mail::Sendmail::log;
- print "\n\n"
+ if ($quiet) {
+ printf "Sent %s\n", $subject;
+ } else {
+ print "OK. Log says:\n", $Mail::Sendmail::log;
+ print "\n\n"
+ }
}
}
$subject = $initial_subject;
foreach my $t (@files) {
$subject = $initial_subject;
foreach my $t (@files) {
- my $F = $t;
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 $header_done = 0;
$message = "";
my $found_mbox = 0;
my $header_done = 0;
$message = "";
$subject = $1;
} elsif (/^(Cc|From):\s+(.*)$/) {
$subject = $1;
} 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, $_);
+ $2, $_) unless $quiet;
push @cc, $2;
}
push @cc, $2;
}
# So let's support that, too.
if (@cc == 0) {
printf("(non-mbox) Adding cc: %s from line '%s'\n",
# So let's support that, too.
if (@cc == 0) {
printf("(non-mbox) Adding cc: %s from line '%s'\n",
- $_, $_);
+ $_, $_) unless $quiet;
push @cc, $_;
push @cc, $_;
}
} else {
$message .= $_;
}
} else {
$message .= $_;
- if (/^Signed-off-by: (.*)$/i) {
+ if (/^Signed-off-by: (.*)$/i && !$no_signed_off_cc) {
my $c = $1;
chomp $c;
push @cc, $c;
printf("(sob) Adding cc: %s from line '%s'\n",
my $c = $1;
chomp $c;
push @cc, $c;
printf("(sob) Adding cc: %s from line '%s'\n",
- $c, $_);
+ $c, $_) unless $quiet;
}
}
}
}
}
}