git-send-email --cc-cmd
This new option allows an arbitrary "cmd" to generate per patch file specific "Cc:"s. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Joe Perches committed
Aug 17, 2007 at 18:51 UTC
324a8bd0cfb696458bc651d3713d7523fd0d7479
2 files changed
+31
-2
Documentation/git-send-email.txt
+9
@@ -34,6 +34,12 @@ The --bcc option must be repeated for each user you want on the bcc list.
34
+
35
The --cc option must be repeated for each user you want on the cc list.
36
37
+--cc-cmd::
38
+ Specify a command to execute once per patch file which
39
+ should generate patch file specific "Cc:" entries.
40
+ Output of this command must be single email address per line.
41
+ Default is the value of 'sendemail.cccmd' configuration value.
42
+
43
--chain-reply-to, --no-chain-reply-to::
44
If this is set, each email will be sent as a reply to the previous
45
email sent. If disabled with "--no-chain-reply-to", all emails after
@@ -124,6 +130,9 @@ sendemail.aliasfiletype::
130
Format of the file(s) specified in sendemail.aliasesfile. Must be
131
one of 'mutt', 'mailrc', 'pine', or 'gnus'.
132
133
+sendemail.cccmd::
134
+ Command to execute to generate per patch file specific "Cc:"s.
135
+
136
sendemail.bcc::
137
Email address (or alias) to always bcc.
138
git-send-email.perl
+22
-2
@@ -46,6 +46,9 @@ Options:
46
--cc Specify an initial "Cc:" list for the entire series
47
of emails.
48
49
+ --cc-cmd Specify a command to execute per file which adds
50
+ per file specific cc address entries
51
+
52
--bcc Specify a list of email addresses that should be Bcc:
53
on all the emails.
54
@@ -157,13 +160,14 @@ if ($@) {
160
my ($quiet, $dry_run) = (0, 0);
161
162
# Variables with corresponding config settings
160
-my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);
163
+my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
164
165
my %config_settings = (
166
"thread" => [\$thread, 1],
167
"chainreplyto" => [\$chain_reply_to, 1],
168
"suppressfrom" => [\$suppress_from, 0],
169
"signedoffcc" => [\$signed_off_cc, 1],
170
+ "cccmd" => [\$cc_cmd, ""],
171
);
172
173
foreach my $setting (keys %config_settings) {
@@ -189,6 +193,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
193
"smtp-server=s" => \$smtp_server,
194
"compose" => \$compose,
195
"quiet" => \$quiet,
196
+ "cc-cmd=s" => \$cc_cmd,
197
"suppress-from!" => \$suppress_from,
198
"signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
199
"dry-run" => \$dry_run,
@@ -652,11 +657,26 @@ foreach my $t (@files) {
657
}
658
}
659
close F;
660
+
661
+ if ($cc_cmd ne "") {
662
+ open(F, "$cc_cmd $t |")
663
+ or die "(cc-cmd) Could not execute '$cc_cmd'";
664
+ while(<F>) {
665
+ my $c = $_;
666
+ $c =~ s/^\s*//g;
667
+ $c =~ s/\n$//g;
668
+ push @cc, $c;
669
+ printf("(cc-cmd) Adding cc: %s from: '%s'\n",
670
+ $c, $cc_cmd) unless $quiet;
671
+ }
672
+ close F
673
+ or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
674
+ }
675
+
676
if (defined $author) {
677
$message = "From: $author\n\n$message";
678
}
679
659
-
680
send_message();
681
682
# set up for the next message