Skip to content

Commit 4e837a9

Browse files
committed
Merge branch 'jp/send-email-cc'
* jp/send-email-cc: git-send-email --cc-cmd
2 parents a94eda6 + 324a8bd commit 4e837a9

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

Documentation/git-send-email.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ The --bcc option must be repeated for each user you want on the bcc list.
3434
+
3535
The --cc option must be repeated for each user you want on the cc list.
3636

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+
3743
--chain-reply-to, --no-chain-reply-to::
3844
If this is set, each email will be sent as a reply to the previous
3945
email sent. If disabled with "--no-chain-reply-to", all emails after
@@ -124,6 +130,9 @@ sendemail.aliasfiletype::
124130
Format of the file(s) specified in sendemail.aliasesfile. Must be
125131
one of 'mutt', 'mailrc', 'pine', or 'gnus'.
126132

133+
sendemail.cccmd::
134+
Command to execute to generate per patch file specific "Cc:"s.
135+
127136
sendemail.bcc::
128137
Email address (or alias) to always bcc.
129138

git-send-email.perl

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ sub usage {
4949
--cc Specify an initial "Cc:" list for the entire series
5050
of emails.
5151
52+
--cc-cmd Specify a command to execute per file which adds
53+
per file specific cc address entries
54+
5255
--bcc Specify a list of email addresses that should be Bcc:
5356
on all the emails.
5457
@@ -160,13 +163,14 @@ sub format_2822_time {
160163
my ($quiet, $dry_run) = (0, 0);
161164

162165
# Variables with corresponding config settings
163-
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);
166+
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
164167

165168
my %config_settings = (
166169
"thread" => [\$thread, 1],
167170
"chainreplyto" => [\$chain_reply_to, 1],
168171
"suppressfrom" => [\$suppress_from, 0],
169172
"signedoffcc" => [\$signed_off_cc, 1],
173+
"cccmd" => [\$cc_cmd, ""],
170174
);
171175

172176
foreach my $setting (keys %config_settings) {
@@ -192,6 +196,7 @@ sub format_2822_time {
192196
"smtp-server=s" => \$smtp_server,
193197
"compose" => \$compose,
194198
"quiet" => \$quiet,
199+
"cc-cmd=s" => \$cc_cmd,
195200
"suppress-from!" => \$suppress_from,
196201
"signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
197202
"dry-run" => \$dry_run,
@@ -655,11 +660,26 @@ sub send_message
655660
}
656661
}
657662
close F;
663+
664+
if ($cc_cmd ne "") {
665+
open(F, "$cc_cmd $t |")
666+
or die "(cc-cmd) Could not execute '$cc_cmd'";
667+
while(<F>) {
668+
my $c = $_;
669+
$c =~ s/^\s*//g;
670+
$c =~ s/\n$//g;
671+
push @cc, $c;
672+
printf("(cc-cmd) Adding cc: %s from: '%s'\n",
673+
$c, $cc_cmd) unless $quiet;
674+
}
675+
close F
676+
or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
677+
}
678+
658679
if (defined $author) {
659680
$message = "From: $author\n\n$message";
660681
}
661682

662-
663683
send_message();
664684

665685
# set up for the next message

0 commit comments

Comments
 (0)