From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752830AbcH3USg (ORCPT ); Tue, 30 Aug 2016 16:18:36 -0400 Received: from smtprelay0009.hostedemail.com ([216.40.44.9]:52826 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750859AbcH3USe (ORCPT ); Tue, 30 Aug 2016 16:18:34 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,,:::::,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1431:1437:1534:1544:1605:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2693:3138:3139:3140:3141:3142:3653:3865:3866:3867:3868:3870:3871:3874:4321:4605:5007:6119:6261:6299:7903:9010:10004:10848:11026:11232:11658:11914:12043:12555:13095:13138:13231:14181:14394:14721:21080:21212:21221:21433:30003:30022:30029:30054:30062:30080:30083,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:14,LUA_SUMMARY:none X-HE-Tag: tin97_2d46c4564c24b X-Filterd-Recvd-Size: 4965 From: Joe Perches To: git@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joe Perches Subject: [PATCH] git-send-email: Add ability to cc: any "trailers" from commit message Date: Tue, 30 Aug 2016 13:18:29 -0700 Message-Id: X-Mailer: git-send-email 2.10.0.rc2.1.gb2aa91d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Many commits have various forms of trailers similar to "Acked-by: Name
" and "Reported-by: Name
" Add the ability to cc these trailers when using git send-email. This can be suppressed with --suppress-cc=trailers. Signed-off-by: Joe Perches --- Documentation/git-send-email.txt | 10 ++++++---- git-send-email.perl | 16 +++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 642d0ef..999c842 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -278,9 +278,10 @@ Automating the value of `sendemail.identity`. --[no-]signed-off-by-cc:: - If this is set, add emails found in Signed-off-by: or Cc: lines to the - cc list. Default is the value of `sendemail.signedoffbycc` configuration - value; if that is unspecified, default to --signed-off-by-cc. + If this is set, add emails found in Signed-off-by: or Cc: or any other + trailer -by: lines to the cc list. Default is the value of + `sendemail.signedoffbycc` configuration value; if that is unspecified, + default to --signed-off-by-cc. --[no-]cc-cover:: If this is set, emails found in Cc: headers in the first patch of @@ -307,8 +308,9 @@ Automating patch body (commit message) except for self (use 'self' for that). - 'sob' will avoid including anyone mentioned in Signed-off-by lines except for self (use 'self' for that). +- 'trailers' will avoid including anyone mentioned in any "-by:" lines. - 'cccmd' will avoid running the --cc-cmd. -- 'body' is equivalent to 'sob' + 'bodycc' +- 'body' is equivalent to 'sob' + 'bodycc' + 'trailers' - 'all' will suppress all auto cc values. -- + diff --git a/git-send-email.perl b/git-send-email.perl index da81be4..255465a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -84,7 +84,7 @@ git send-email --dump-aliases --identity * Use the sendemail. options. --to-cmd * Email To: via ` \$patch_path` --cc-cmd * Email Cc: via ` \$patch_path` - --suppress-cc * author, self, sob, cc, cccmd, body, bodycc, all. + --suppress-cc * author, self, sob, cc, cccmd, body, bodycc, trailers, all. --[no-]cc-cover * Email Cc: addresses in the cover letter. --[no-]to-cover * Email To: addresses in the cover letter. --[no-]signed-off-by-cc * Send to Signed-off-by: addresses. Default on. @@ -431,13 +431,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|body|bodycc)$/; + unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|trailers)$/; $suppress_cc{$entry} = 1; } } if ($suppress_cc{'all'}) { - foreach my $entry (qw (cccmd cc author self sob body bodycc)) { + foreach my $entry (qw (cccmd cc author self sob body bodycc trailers)) { $suppress_cc{$entry} = 1; } delete $suppress_cc{'all'}; @@ -448,7 +448,7 @@ $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)) { + foreach my $entry (qw (sob bodycc trailers)) { $suppress_cc{$entry} = 1; } delete $suppress_cc{'body'}; @@ -1545,7 +1545,7 @@ foreach my $t (@files) { # Now parse the message body while(<$fh>) { $message .= $_; - if (/^(Signed-off-by|Cc): (.*)$/i) { + if (/^(Signed-off-by|Cc|[^\s]+[_-]by): (.*)$/i) { chomp; my ($what, $c) = ($1, $2); chomp $c; @@ -1555,6 +1555,12 @@ foreach my $t (@files) { } else { next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i; next if $suppress_cc{'bodycc'} and $what =~ /Cc/i; + next if $suppress_cc{'trailers'} and $what !~ /Signed-off-by/i && $what =~ /by$/i; + } + if ($c !~ /.+@.+/) { + printf("(body) Ignoring %s from line '%s'\n", + $what, $_) unless $quiet; + next; } push @cc, $c; printf("(body) Adding cc: %s from line '%s'\n", -- 2.10.0.rc2.1.gb2aa91d