summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-02-15 04:32:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-15 05:48:38 (GMT)
commit3531e2703d8e441bfb4a6765459317b3db3f224c (patch)
tree314658095ed5208f11fd851835b98c47af67ce61 /git-send-email.perl
parent5012699d9840fe34fe0838ea0d529c2f32f76b82 (diff)
downloadgit-3531e2703d8e441bfb4a6765459317b3db3f224c.zip
git-3531e2703d8e441bfb4a6765459317b3db3f224c.tar.gz
git-3531e2703d8e441bfb4a6765459317b3db3f224c.tar.bz2
send-email: --suppress-cc improvements
Since 6564828 (git-send-email: Generalize auto-cc recipient mechanism., 2007-12-25) we can suppress automatic Cc generation separately for each of the possible address sources. However, --suppress-cc=sob suppressed both SOB lines and body (but not header) Cc lines, contrary to the name. Change --suppress-cc=sob to mean only SOB lines, and add separate choices 'bodycc' (body Cc lines) and 'body' (both 'sob' and 'bodycc'). The option --no-signed-off-by-cc now acts like --suppress-cc=sob, which is not backwards compatible but matches the name of the option. Also update the documentation and add a few tests. Original patch by me. Revised by Thomas Rast, who contributed the documentation and test updates. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl28
1 files changed, 19 insertions, 9 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index a6efd1f..54e7617 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -68,9 +68,8 @@ git send-email [options] <file | directory | rev-list options >
Automating:
--identity <str> * Use the sendemail.<id> options.
--cc-cmd <str> * Email Cc: via `<str> \$patch_path`
- --suppress-cc <str> * author, self, sob, cccmd, all.
- --[no-]signed-off-by-cc * Send to Cc: and Signed-off-by:
- addresses. Default on.
+ --suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, all.
+ --[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
--[no-]suppress-from * Send to self. Default off.
--[no-]chain-reply-to * Chain In-Reply-To: fields. Default on.
--[no-]thread * Use In-Reply-To: field. Default on.
@@ -325,13 +324,13 @@ my(%suppress_cc);
if (@suppress_cc) {
foreach my $entry (@suppress_cc) {
die "Unknown --suppress-cc field: '$entry'\n"
- unless $entry =~ /^(all|cccmd|cc|author|self|sob)$/;
+ unless $entry =~ /^(all|cccmd|cc|author|self|sob|body|bodycc)$/;
$suppress_cc{$entry} = 1;
}
}
if ($suppress_cc{'all'}) {
- foreach my $entry (qw (ccmd cc author self sob)) {
+ foreach my $entry (qw (ccmd cc author self sob body bodycc)) {
$suppress_cc{$entry} = 1;
}
delete $suppress_cc{'all'};
@@ -341,6 +340,13 @@ if ($suppress_cc{'all'}) {
$suppress_cc{'self'} = $suppress_from if defined $suppress_from;
$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
+if ($suppress_cc{'body'}) {
+ foreach my $entry (qw (sob bodycc)) {
+ $suppress_cc{$entry} = 1;
+ }
+ delete $suppress_cc{'body'};
+}
+
# Debugging, print out the suppressions.
if (0) {
print "suppressions:\n";
@@ -1020,13 +1026,17 @@ foreach my $t (@files) {
while(<F>) {
$message .= $_;
if (/^(Signed-off-by|Cc): (.*)$/i) {
- next if ($suppress_cc{'sob'});
chomp;
- my $c = $2;
+ my ($what, $c) = ($1, $2);
chomp $c;
- next if ($c eq $sender and $suppress_cc{'self'});
+ if ($c eq $sender) {
+ next if ($suppress_cc{'self'});
+ } else {
+ next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
+ next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+ }
push @cc, $c;
- printf("(sob) Adding cc: %s from line '%s'\n",
+ printf("(body) Adding cc: %s from line '%s'\n",
$c, $_) unless $quiet;
}
}