Merge branch 'jp/send-email-cc'
authorJunio C Hamano <gitster@pobox.com>
Sat, 1 Sep 2007 20:15:27 +0000 (13:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 1 Sep 2007 20:15:27 +0000 (13:15 -0700)
* jp/send-email-cc:
git-send-email --cc-cmd

1  2 
Documentation/git-send-email.txt
git-send-email.perl
index 8231286e09eb462d86679569f6911767b00deaf4,a63a3adab09a1563908114903ff1a6d82196ed97..16bfd7be2271d21d8d380e9f4e20307569f3a538
@@@ -34,6 -34,12 +34,12 @@@ The --bcc option must be repeated for e
  +
  The --cc option must be repeated for each user you want on the cc list.
  
+ --cc-cmd::
+       Specify a command to execute once per patch file which
+       should generate patch file specific "Cc:" entries.
+       Output of this command must be single email address per line.
+       Default is the value of 'sendemail.cccmd' configuration value.
  --chain-reply-to, --no-chain-reply-to::
        If this is set, each email will be sent as a reply to the previous
        email sent.  If disabled with "--no-chain-reply-to", all emails after
@@@ -62,7 -68,7 +68,7 @@@
  --signed-off-by-cc, --no-signed-off-by-cc::
          If this is set, add emails found in Signed-off-by: or Cc: lines to the
          cc list.
 -        Default is the value of 'sendemail.signedoffbycc' configuration value;
 +        Default is the value of 'sendemail.signedoffcc' configuration value;
          if that is unspecified, default to --signed-off-by-cc.
  
  --quiet::
@@@ -88,7 -94,7 +94,7 @@@
          If this is set, do not add the From: address to the cc: list, if it
          shows up in a From: line.
          Default is the value of 'sendemail.suppressfrom' configuration value;
 -        if that is unspecified, default to --no-supress-from.
 +        if that is unspecified, default to --no-suppress-from.
  
  --thread, --no-thread::
        If this is set, the In-Reply-To header will be set on each email sent.
@@@ -124,6 -130,9 +130,9 @@@ sendemail.aliasfiletype:
        Format of the file(s) specified in sendemail.aliasesfile. Must be
        one of 'mutt', 'mailrc', 'pine', or 'gnus'.
  
+ sendemail.cccmd::
+       Command to execute to generate per patch file specific "Cc:"s.
  sendemail.bcc::
        Email address (or alias) to always bcc.
  
diff --combined git-send-email.perl
index f1a88556824e098ab9594a6018e127c50c7fa51a,4767249e6d9ef25a6618e99a2557cd909be1573c..e0b7d1245eb78b2a74d9de3e86154ebe93f93ca4
@@@ -21,11 -21,8 +21,11 @@@ use warnings
  use Term::ReadLine;
  use Getopt::Long;
  use Data::Dumper;
 +use Term::ANSIColor;
  use Git;
  
 +$SIG{INT} = sub { print color("reset"), "\n"; exit };
 +
  package FakeTerm;
  sub new {
        my ($class, $reason) = @_;
@@@ -49,6 -46,9 +49,9 @@@ Options
     --cc           Specify an initial "Cc:" list for the entire series
                    of emails.
  
+    --cc-cmd       Specify a command to execute per file which adds
+                   per file specific cc address entries
     --bcc          Specify a list of email addresses that should be Bcc:
                  on all the emails.
  
@@@ -160,13 -160,14 +163,14 @@@ if ($@) 
  my ($quiet, $dry_run) = (0, 0);
  
  # Variables with corresponding config settings
- my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc);
+ my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
  
  my %config_settings = (
      "thread" => [\$thread, 1],
      "chainreplyto" => [\$chain_reply_to, 1],
      "suppressfrom" => [\$suppress_from, 0],
      "signedoffcc" => [\$signed_off_cc, 1],
+     "cccmd" => [\$cc_cmd, ""],
  );
  
  foreach my $setting (keys %config_settings) {
@@@ -192,6 -193,7 +196,7 @@@ my $rc = GetOptions("sender|from=s" => 
                    "smtp-server=s" => \$smtp_server,
                    "compose" => \$compose,
                    "quiet" => \$quiet,
+                   "cc-cmd=s" => \$cc_cmd,
                    "suppress-from!" => \$suppress_from,
                    "signed-off-cc|signed-off-by-cc!" => \$signed_off_cc,
                    "dry-run" => \$dry_run,
@@@ -655,11 -657,26 +660,26 @@@ foreach my $t (@files) 
                }
        }
        close F;
+       if ($cc_cmd ne "") {
+               open(F, "$cc_cmd $t |")
+                       or die "(cc-cmd) Could not execute '$cc_cmd'";
+               while(<F>) {
+                       my $c = $_;
+                       $c =~ s/^\s*//g;
+                       $c =~ s/\n$//g;
+                       push @cc, $c;
+                       printf("(cc-cmd) Adding cc: %s from: '%s'\n",
+                               $c, $cc_cmd) unless $quiet;
+               }
+               close F
+                       or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
+       }
        if (defined $author) {
                $message = "From: $author\n\n$message";
        }
  
        send_message();
  
        # set up for the next message