All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rv@rasmusvillemoes.dk>
To: git@vger.kernel.org
Cc: Rasmus Villemoes <rv@rasmusvillemoes.dk>, Joe Perches <joe@perches.com>
Subject: [PATCH 3/3] send-email: also pick up cc addresses from -by trailers
Date: Wed, 10 Oct 2018 13:13:51 +0200	[thread overview]
Message-ID: <20181010111351.5045-4-rv@rasmusvillemoes.dk> (raw)
In-Reply-To: <20181010111351.5045-1-rv@rasmusvillemoes.dk>

When rerolling a patch series, including various Reviewed-by etc. that
may have come in, it is quite convenient to have git-send-email
automatically cc those people.

So pick up any *-by lines, with a new suppression category 'misc-by',
but special-case Signed-off-by, since that already has its own
suppression category. It seems natural to make 'misc-by' implied by
'body'.

Based-on-patch-by: Joe Perches <joe@perches.com>
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
---
 Documentation/git-send-email.txt |  5 ++++-
 git-send-email.perl              | 14 ++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index ea6ea512fe..f6010ac68b 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -329,8 +329,11 @@ 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).
+- 'misc-by' will avoid including anyone mentioned in Acked-by,
+  Reviewed-by, Tested-by and other "-by" lines in the patch body,
+  except Signed-off-by (use 'sob' for that).
 - 'cccmd' will avoid running the --cc-cmd.
-- 'body' is equivalent to 'sob' + 'bodycc'.
+- 'body' is equivalent to 'sob' + 'bodycc' + 'misc-by'.
 - 'all' will suppress all auto cc values.
 --
 +
diff --git a/git-send-email.perl b/git-send-email.perl
index 1916159d2a..7a6391e5d8 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -94,7 +94,7 @@ sub usage {
     --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, misc-by, 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.
@@ -454,13 +454,13 @@ sub read_config {
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die sprintf(__("Unknown --suppress-cc field: '%s'\n"), $entry)
-			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc|misc-by)$/;
 		$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 misc-by)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -471,7 +471,7 @@ sub read_config {
 $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 misc-by)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'body'};
@@ -1681,7 +1681,7 @@ sub process_file {
 	# Now parse the message body
 	while(<$fh>) {
 		$message .=  $_;
-		if (/^(Signed-off-by|Cc): (.*)/i) {
+		if (/^([a-z-]*-by|Cc): (.*)/i) {
 			chomp;
 			my ($what, $c) = ($1, $2);
 			# strip garbage for the address we'll use:
@@ -1691,7 +1691,9 @@ sub process_file {
 			if ($sc eq $sender) {
 				next if ($suppress_cc{'self'});
 			} else {
-				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
+				next if $suppress_cc{'sob'} and $what =~ /^Signed-off-by$/i;
+				next if $suppress_cc{'misc-by'}
+					and $what =~ /-by$/i and $what !~ /^Signed-off-by$/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
 			}
 			if ($c !~ /.+@.+|<.+>/) {
-- 
2.19.1.6.g084f1d7761


  parent reply	other threads:[~2018-10-10 11:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 11:13 [PATCH 0/3] send-email: Also pick up cc addresses from -by trailers Rasmus Villemoes
2018-10-10 11:13 ` [PATCH 1/3] Documentation/git-send-email.txt: style fixes Rasmus Villemoes
2018-10-10 11:13 ` [PATCH 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing Rasmus Villemoes
2018-10-10 12:57   ` Ævar Arnfjörð Bjarmason
2018-10-10 13:29     ` Rasmus Villemoes
2018-10-11  6:06       ` Junio C Hamano
2018-10-11  7:06         ` Rasmus Villemoes
2018-10-11  8:22           ` Junio C Hamano
2018-10-10 11:13 ` Rasmus Villemoes [this message]
2018-10-10 12:51   ` [PATCH 3/3] send-email: also pick up cc addresses from -by trailers Ævar Arnfjörð Bjarmason
2018-10-11  6:18   ` Junio C Hamano
2018-10-11  7:11     ` Rasmus Villemoes
2018-10-16  5:57       ` Junio C Hamano
2018-10-16  7:17         ` Rasmus Villemoes
2018-10-16  7:46           ` Junio C Hamano
2018-10-16  7:39 ` [PATCH v2 0/3] send-email: Also " Rasmus Villemoes
2018-10-16  7:39   ` [PATCH v2 1/3] Documentation/git-send-email.txt: style fixes Rasmus Villemoes
2018-10-16  7:39   ` [PATCH v2 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing Rasmus Villemoes
2018-10-16  7:39   ` [PATCH v2 3/3] send-email: also pick up cc addresses from -by trailers Rasmus Villemoes
2018-10-16  7:57   ` [PATCH v2 0/3] send-email: Also " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181010111351.5045-4-rv@rasmusvillemoes.dk \
    --to=rv@rasmusvillemoes.dk \
    --cc=git@vger.kernel.org \
    --cc=joe@perches.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.