From 3531e2703d8e441bfb4a6765459317b3db3f224c Mon Sep 17 00:00:00 2001 From: Jay Soffian Date: Sat, 14 Feb 2009 23:32:15 -0500 Subject: 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 Signed-off-by: Junio C Hamano --- git-send-email.perl | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'git-send-email.perl') diff --git a/git-send-email.perl b/git-send-email.perl index a6efd1fa27..54e76173f9 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -68,9 +68,8 @@ git send-email [options] Automating: --identity * Use the sendemail. options. --cc-cmd * Email Cc: via ` \$patch_path` - --suppress-cc * author, self, sob, cccmd, all. - --[no-]signed-off-by-cc * Send to Cc: and Signed-off-by: - addresses. Default on. + --suppress-cc * 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() { $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; } } -- cgit v1.2.1