git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Suppressing auto-cc for specific addresses

From
Daniel Mack <zonque@gmail.com>
Date
Aug 7, 2011, 20:20 UTC
Message-ID
<4E3EF38A.9010307@gmail.com>
Hi,

I'm looking for a way to suppress certain Cc: fields that are normally automatically added for addresses mentioned in Cc: lines found in patches.

In particular, the kernel rules for marking patches for stable release inclusion wants users to add a "Cc: stable@kernel.org" line in the patch itself but to not actually send a copy of that patch to that address. It will be picked automatically once the patch was applied upstream.

I couldn't find a proper way to do that with git send-email, so I dare to come up with a patch proposal. Is that acceptable or is there any better way (which I'm not aware about) to achive this?

Thanks, Daniel

From f1a17a4fbc0373283696cb560afff3afa05c2e8f Mon Sep 17 00:00:00 2001
From: Daniel Mack <zonque@gmail.com>
Date: Sun, 7 Aug 2011 22:16:00 +0200
Subject: [PATCH] send-email: Allow email addresses and domains as
 --suppress-cc options
Signed-off-by: Daniel Mack <zonque@gmail.com>
---
 Documentation/git-send-email.txt |   10 +++++++---
 git-send-email.perl              |   12 +++++++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 327233c..5966abb 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -233,9 +233,9 @@ Automating
 	cc list. Default is the value of 'sendemail.signedoffbycc' configuration
 	value; if that is unspecified, default to --signed-off-by-cc.
 
---suppress-cc=<category>::
-	Specify an additional category of recipients to suppress the
-	auto-cc of:
+--suppress-cc=<category|address|domain>::
+	Specify an additional category, email address or domain of recipients
+	to suppress the auto-cc for. Possible categories are:
 +
 --
 - 'author' will avoid including the patch author
@@ -251,6 +251,10 @@ Automating
 - 'all' will suppress all auto cc values.
 --
 +
+If a full email address is given, auto-cc will be suppressed for this particular
+address. This also works for entire domains if the parameter starts with the '@'
+sign. All email addresses in that domain will hence be ignored by auto-cc.
++
 Default is the value of 'sendemail.suppresscc' configuration value; if
 that is unspecified, default to 'self' if --suppress-from is
 specified, as well as 'body' if --no-signed-off-cc is specified.
diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..22813e5 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -374,7 +374,7 @@ 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|.*@.*)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
@@ -1213,6 +1213,11 @@ foreach my $t (@files) {
 					} else {
 						next if ($suppress_cc{'cc'});
 					}
+					next if ($suppress_cc{$addr});
+					if ($addr =~ /^(.+)(@.+)$/) {
+						my $domain = $2;
+						next if $suppress_cc{$domain};
+					}
 					printf("(mbox) Adding cc: %s from line '%s'\n",
 						$addr, $_) unless $quiet;
 					push @cc, $addr;
@@ -1261,6 +1266,11 @@ foreach my $t (@files) {
 				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
 			}
+			next if ($suppress_cc{$c});
+			if ($c =~ /^(.+)(@.+)$/) {
+				my $domain = $2;
+				next if $suppress_cc{$domain};
+			}
 			push @cc, $c;
 			printf("(body) Adding cc: %s from line '%s'\n",
 				$c, $_) unless $quiet;
-- 
1.7.6
Next: Greg KH
Message 1 of 12 in “Suppressing auto-cc for specific addresses”
  1. Daniel MackAug 7, 2011
  2. Greg KHAug 7, 2011
  3. Daniel MackAug 8, 2011
  4. Jonathan NiederAug 8, 2011
  5. Joe PerchesAug 9, 2011
  6. Daniel MackAug 8, 2011
  7. Jeff KingAug 8, 2011
  8. Daniel MackAug 8, 2011
  9. Greg KHAug 8, 2011
  10. Jonathan NiederAug 8, 2011
  11. Jeff KingAug 9, 2011
  12. Daniel MackAug 9, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.