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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 25, 2007, 21:04 UTC
Message-ID
<7vk5n2o58p.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1198532163-25308-1-git-send-email-git@davidb.org>
David Brown <git@davidb.org> writes:
Show 13 quoted lines
> ...
>   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 <git@davidb.org>
> ...
> 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');
Previous: David BrownNext: David Brown
Message 13 of 17 in “git-send-email: Add --suppress-all-from option.”
  1. git-send-email: Add --suppress-all-from option.David Brown, Dec 21, 2007
  2. Joel BeckerDec 21, 2007
  3. Brian SwetlandDec 21, 2007
  4. Junio C HamanoDec 21, 2007
  5. Joel BeckerDec 21, 2007
  6. Theodore TsoDec 22, 2007
  7. David BrownDec 21, 2007
  8. git-send-email: Generalize auto-cc recipient mechanism.David Brown, Dec 24, 2007
  9. Joel BeckerDec 24, 2007
  10. git-send-email: Add --suppress-cc allDavid Brown, Dec 24, 2007
  11. Joel BeckerDec 24, 2007
  12. git-send-email: Generalize auto-cc recipient mechanism.David Brown, Dec 24, 2007
  13. Junio C HamanoDec 25, 2007
  14. David BrownDec 26, 2007
  15. git-send-email: Generalize auto-cc recipient mechanism.David Brown, Dec 26, 2007
  16. SeanDec 26, 2007
  17. David BrownDec 26, 2007

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.