Re: [PATCH] git-send-email: Add auto-cc to all body signatures

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] git-send-email: Add auto-cc to all body signatures

From: Rasmus Villemoes <hidden>
Date: 2016-06-15 23:07:21

On Thu, Dec 08 2011, Joe Perches [off-list ref] wrote:
On Thu, 2011-12-08 at 11:37 -0800, Junio C Hamano wrote:
quoted
Joe Perches [off-list ref] writes:
quoted
Many types of signatures are used by various projects.
The most common type is formatted:
	"[some_signature_type]-by: First Last [off-list ref]"
e.g:
	"Reported-by: First Last [off-list ref]" (no quotes are used)
This is just a phrasing issue, but I am a bit reluctant about the name
"signature".
I've called all these markings signatures.
Maybe email-address-tags or another name could be used.
I'm not bothered one way or another by any chosen name.
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, or should I use a --cc-cmd to do what I want?

Rasmus

[PATCH V3] git-send-email: Add auto-cc to all body signatures

From: Joe Perches <joe@perches.com>
Date: 2016-06-15 23:07:21

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",
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help