Thread (5 messages) flat view 5 messages, 3 authors, 2016-06-15

Re: [PATCH] git-send-email: Generalize auto-cc recipient mechanism.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:01
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

David Brown [off-list ref] writes:
...
  self   - patch sender.  Same as --suppress-from.
  author - patch author.
  cc     - cc lines mentioned in the patch.
  cccmd  - avoid running the cccmd.
  sob    - signed off by lines.
  all    - all non-explicit recipients

Signed-off-by: David Brown <redacted>
...
What bothers me most about this change is that --signed-of-cc
and --suppress-from are silently ignored if --suppress-cc is given, either
on the command line, or in the config.
The order in which various variables are set in the current code
before your patch is like this:

 * my ($var) introduces them -- they are undefined at the
   beginning;

 * GetOptions() may set them to explicit values;

 * read_config(), first for the specific sendemail identity and
   then for the generic ones, fill the ones that are still
   undefined;

 * the built-in default from %config_bool_settings are used to
   fill the ones that are still undefined at this point;

Now, I think you can build on top of the above by adding the
following after that sequence:

 * fill %suppress_cc with explicit @suppress_cc GetOptions and
   read_config() read;

 * if the --suppress-from and/or --signed-off-by-cc, either from
   GetOptions() or from read_config() are given, make them
   override what @suppress_cc says.  So giving --suppress-cc=all
   and --signed-off-by-cc at the same time will still send cc to
   people who signed off the patch (because these old-style ones
   are more specific).

Perhaps something like this (untested, of course!) patch on top
of yours.


 git-send-email.perl |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 1f03d12..cde5ffb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -188,8 +188,8 @@ my (@suppress_cc);
 my %config_bool_settings = (
     "thread" => [\$thread, 1],
     "chainreplyto" => [\$chain_reply_to, 1],
-    "suppressfrom" => [\$suppress_from, 0],
-    "signedoffcc" => [\$signed_off_cc, 1],
+    "suppressfrom" => [\$suppress_from, undef],
+    "signedoffcc" => [\$signed_off_cc, undef],
     "smtpssl" => [\$smtp_ssl, 0],
 );
 
@@ -279,18 +279,20 @@ if (@suppress_cc) {
 			unless $entry =~ /^(all|cccmd|cc|author|self|sob)$/;
 		$suppress_cc{$entry} = 1;
 	}
-} else {
-	# Convert the old-style options.
-	$suppress_cc{'self'} = 1 if $suppress_from;
-	$suppress_cc{'sob'} = 1 unless $signed_off_cc;
 }
-
 if ($suppress_cc{'all'}) {
 	foreach my $entry (qw (ccmd cc author self sob)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
 }
+# If explicit old-style ones are specified, they trump supress-cc
+if (defined $suppress_from) {
+	$suppress_cc{'self'} = $suppress_from;
+}
+if (defined $signed_off_cc) {
+	$suppress_cc{'sob'} = !$signed_off_cc;
+}
 
 my ($repoauthor) = $repo->ident_person('author');
 my ($repocommitter) = $repo->ident_person('committer');
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help