Many types of signatures are used by various projects.

The most common type is formatted:
        "[some_signature_type]-by: First Last <email <at> domain.tld>"
e.g:
        "Reported-by: First Last <email <at> domain.tld>" (no quotes are used)

Make git-send-email use these signatures as "CC:" entries.

Add command line option --suppress-cc=signatures to avoid
adding these entries to the cc.

Signed-off-by: Joe Perches <joe <at> perches.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher <at> intel.com>
---
> It's been four years, but I recently ran into this. I mistakenly thought
> that git would actually pick up cc addresses also from Reported-by, so
> the reporter ended up not being cc'ed. Is there any chance this could be
> revisited,

Here's a refresh if desired.  I still think it's sensible.

 Documentation/git-send-email.txt |  3 ++-
 git-send-email.perl              | 11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index b9134d2..0866ae2 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -306,8 +306,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).
+- 'signatures' will avoid including anyone mentioned in any "<foo>-by:" lines.
 - 'cccmd' will avoid running the --cc-cmd.
-- 'body' is equivalent to 'sob' + 'bodycc'
+- 'body' is equivalent to 'sob' + 'bodycc' + 'signatures'
 - 'all' will suppress all auto cc values.
 --
 +
diff --git a/git-send-email.perl b/git-send-email.perl
index e907e0ea..536e264 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -83,7 +83,7 @@ git send-email [options] <file | directory | rev-list options 
>
     --identity              <str>  * Use the sendemail.<id> options.
     --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
-    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, 
bodycc, all.
+    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, 
bodycc, signatures, 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.
@@ -421,13 +421,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|signatures)$/;
                $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 
signatures)) {
                $suppress_cc{$entry} = 1;
        }
        delete $suppress_cc{'all'};
@@ -438,7 +438,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 signatures)) {
                $suppress_cc{$entry} = 1;
        }
        delete $suppress_cc{'body'};
@@ -1516,7 +1516,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;
@@ -1526,6 +1526,7 @@ 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{'signatures'} and $what =~ 
/by$/i;
                        }
                        push @cc, $c;
                        printf("(body) Adding cc: %s from line '%s'\n",
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to