Re: [PATCH] git-send-email.perl: Add --suppress-to
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:31
Joe Perches [off-list ref] writes:
+- 'author' will avoid including the patch author +- 'self' will avoid including the sender +- 'tocmd' will avoid running the --to-cmd +- 'bodyto' will avoid including anyone mentioned in To lines in the + patch body (commit message) except for self (use 'self' for that) +- 'all' will suppress all auto to values.
Is there a definition of what an "auto to value" is somewhere? "auto cc values" was sort of understandable as there is no word "cc" (other than 1/1000 litre ;-) and what it meant was guessable from context, but it took me a few seconds to realize you meant "To:" with this.
+-- ++ +Default is the value of 'sendemail.suppressto' configuration value; if +that is unspecified, default to 'self' if --suppress-from is +specified. + --suppress-cc=<category>:: Specify an additional category of recipients to suppress the auto-cc of:
Hmmm, from a cursory look I don't see how bodyto is handled and where.
quoted hunk
@@ -1201,6 +1227,9 @@ foreach my $t (@files) { } elsif (/^To:\s+(.*)$/) { foreach my $addr (parse_address_line($1)) { + + next if $suppress_to{'author'};
Is "To: somebody" in the output guaranteed to name the author and nobody else?
+ next if $suppress_to{'self'} and $author eq $sender;
printf("(mbox) Adding to: %s from line '%s'\n",
$addr, $_) unless $quiet;
push @to, sanitize_address($addr);quoted hunk
@@ -1269,7 +1298,7 @@ foreach my $t (@files) { close $fh; push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t) - if defined $to_cmd; + if defined $to_cmd && !$suppress_to{'tocmd'}; push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t) if defined $cc_cmd && !$suppress_cc{'cccmd'};
I think it is about time to make this a bit more readable by explicitly using if statement, not statement modifiers.