Skip to content

Commit 8a0d060

Browse files
committed
Merge branch 'rv/send-email-cc-misc-by'
"git send-email" learned to grab address-looking string on any trailer whose name ends with "-by"; --suppress-cc=misc-by on the command line, or setting sendemail.suppresscc configuration variable to "misc-by", can be used to disable this behaviour. This is a backward-incompatible change that may surprise existing users. * rv/send-email-cc-misc-by: send-email: also pick up cc addresses from -by trailers send-email: only consider lines containing @ or <> for automatic Cc'ing Documentation/git-send-email.txt: style fixes
2 parents d450e56 + ef0cc1d commit 8a0d060

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

Documentation/git-send-email.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,19 @@ Automating
321321
auto-cc of:
322322
+
323323
--
324-
- 'author' will avoid including the patch author
325-
- 'self' will avoid including the sender
324+
- 'author' will avoid including the patch author.
325+
- 'self' will avoid including the sender.
326326
- 'cc' will avoid including anyone mentioned in Cc lines in the patch header
327327
except for self (use 'self' for that).
328328
- 'bodycc' will avoid including anyone mentioned in Cc lines in the
329329
patch body (commit message) except for self (use 'self' for that).
330330
- 'sob' will avoid including anyone mentioned in Signed-off-by lines except
331-
for self (use 'self' for that).
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).
332335
- 'cccmd' will avoid running the --cc-cmd.
333-
- 'body' is equivalent to 'sob' + 'bodycc'
336+
- 'body' is equivalent to 'sob' + 'bodycc' + 'misc-by'.
334337
- 'all' will suppress all auto cc values.
335338
--
336339
+

git-send-email.perl

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ sub usage {
9494
--identity <str> * Use the sendemail.<id> options.
9595
--to-cmd <str> * Email To: via `<str> \$patch_path`
9696
--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.
9898
--[no-]cc-cover * Email Cc: addresses in the cover letter.
9999
--[no-]to-cover * Email To: addresses in the cover letter.
100100
--[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on.
@@ -454,13 +454,13 @@ sub read_config {
454454
if (@suppress_cc) {
455455
foreach my $entry (@suppress_cc) {
456456
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)$/;
458458
$suppress_cc{$entry} = 1;
459459
}
460460
}
461461

462462
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)) {
464464
$suppress_cc{$entry} = 1;
465465
}
466466
delete $suppress_cc{'all'};
@@ -471,7 +471,7 @@ sub read_config {
471471
$suppress_cc{'sob'} = !$signed_off_by_cc if defined $signed_off_by_cc;
472472

473473
if ($suppress_cc{'body'}) {
474-
foreach my $entry (qw (sob bodycc)) {
474+
foreach my $entry (qw (sob bodycc misc-by)) {
475475
$suppress_cc{$entry} = 1;
476476
}
477477
delete $suppress_cc{'body'};
@@ -1681,7 +1681,7 @@ sub process_file {
16811681
# Now parse the message body
16821682
while(<$fh>) {
16831683
$message .= $_;
1684-
if (/^(Signed-off-by|Cc): (.*)/i) {
1684+
if (/^([a-z-]*-by|Cc): (.*)/i) {
16851685
chomp;
16861686
my ($what, $c) = ($1, $2);
16871687
# strip garbage for the address we'll use:
@@ -1691,8 +1691,18 @@ sub process_file {
16911691
if ($sc eq $sender) {
16921692
next if ($suppress_cc{'self'});
16931693
} 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",
1704+
$what, $_) unless $quiet;
1705+
next;
16961706
}
16971707
push @cc, $c;
16981708
printf(__("(body) Adding cc: %s from line '%s'\n"),

0 commit comments

Comments
 (0)