send-email: also pick up cc addresses from -by trailers
When rerolling a patch series, including various Reviewed-by etc. that may have come in, it is quite convenient to have git-send-email automatically cc those people. So pick up any *-by lines, with a new suppression category 'misc-by', but special-case Signed-off-by, since that already has its own suppression category. It seems natural to make 'misc-by' implied by 'body'. Based-on-patch-by: Joe Perches <joe@perches.com> Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Rasmus Villemoes committed
Oct 16, 2018 at 09:39 UTC
ef0cc1df90f6b6c2987ab2db8e0ccf2cfc421edf
2 files changed
+16
-8
Documentation/git-send-email.txt
+4
-1
@@ -329,8 +329,11 @@ Automating
329
patch body (commit message) except for self (use 'self' for that).
330
- 'sob' will avoid including anyone mentioned in Signed-off-by lines except
331
for self (use 'self' for that).
332
+- 'misc-by' will avoid including anyone mentioned in Acked-by,
333
+ Reviewed-by, Tested-by and other "-by" lines in the patch body,
334
+ except Signed-off-by (use 'sob' for that).
335
- 'cccmd' will avoid running the --cc-cmd.
333
-- 'body' is equivalent to 'sob' + 'bodycc'.
336
+- 'body' is equivalent to 'sob' + 'bodycc' + 'misc-by'.
337
- 'all' will suppress all auto cc values.
338
--
339
+
git-send-email.perl
+12
-7
@@ -94,7 +94,7 @@ git send-email --dump-aliases
94
--identity <str> * Use the sendemail.<id> options.
95
--to-cmd <str> * Email To: via `<str> \$patch_path`
96
--cc-cmd <str> * Email Cc: via `<str> \$patch_path`
97
- --suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, all.
97
+ --suppress-cc <str> * author, self, sob, cc, cccmd, body, bodycc, misc-by, all.
98
--[no-]cc-cover * Email Cc: addresses in the cover letter.
99
--[no-]to-cover * Email To: addresses in the cover letter.
100
--[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
@@ -454,13 +454,13 @@ my(%suppress_cc);
454
if (@suppress_cc) {
455
foreach my $entry (@suppress_cc) {
456
die sprintf(__("Unknown --suppress-cc field: '%s'\n"), $entry)
457
- unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
457
+ unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|misc-by)$/;
458
$suppress_cc{$entry} = 1;
459
}
460
}
461
462
if ($suppress_cc{'all'}) {
463
- foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
463
+ foreach my $entry (qw (cccmd cc author self sob body bodycc misc-by)) {
464
$suppress_cc{$entry} = 1;
465
}
466
delete $suppress_cc{'all'};
@@ -471,7 +471,7 @@ $suppress_cc{'self'} = $suppress_from if defined $suppress_from;
471
$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
472
473
if ($suppress_cc{'body'}) {
474
- foreach my $entry (qw (sob bodycc)) {
474
+ foreach my $entry (qw (sob bodycc misc-by)) {
475
$suppress_cc{$entry} = 1;
476
}
477
delete $suppress_cc{'body'};
@@ -1681,7 +1681,7 @@ sub process_file {
1681
# Now parse the message body
1682
while(<$fh>) {
1683
$message .= $_;
1684
- if (/^(Signed-off-by|Cc): (.*)/i) {
1684
+ if (/^([a-z-]*-by|Cc): (.*)/i) {
1685
chomp;
1686
my ($what, $c) = ($1, $2);
1687
# strip garbage for the address we'll use:
@@ -1691,8 +1691,13 @@ sub process_file {
1691
if ($sc eq $sender) {
1692
next if ($suppress_cc{'self'});
1693
} else {
1694
- next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
1695
- next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
1694
+ if ($what =~ /^Signed-off-by$/i) {
1695
+ next if $suppress_cc{'sob'};
1696
+ } elsif ($what =~ /-by$/i) {
1697
+ next if $suppress_cc{'misc-by'};
1698
+ } elsif ($what =~ /Cc/i) {
1699
+ next if $suppress_cc{'bodycc'};
1700
+ }
1701
}
1702
if ($c !~ /.+@.+|<.+>/) {
1703
printf("(body) Ignoring %s from line '%s'\n",