author | Junio C Hamano <gitster@pobox.com> | |
Thu, 30 Sep 2010 22:00:03 +0000 (15:00 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 30 Sep 2010 22:00:03 +0000 (15:00 -0700) |
* jp/send-email-to-cmd:
git-send-email.perl: Add --to-cmd
Conflicts:
git-send-email.perl
git-send-email.perl: Add --to-cmd
Conflicts:
git-send-email.perl
1 | 2 | |||
---|---|---|---|---|
Documentation/git-send-email.txt | patch | | diff1 | | diff2 | | blob | history |
git-send-email.perl | patch | | diff1 | | diff2 | | blob | history |
t/t9001-send-email.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/git-send-email.txt
Simple merge
diff --cc git-send-email.perl
index b9bb18cd56eaccc4a9048ae130fccedb467b8d29,a73b655e417df641b8213734aa3ba19bd9914973..aef359451e61966beb48dccbf42ac66fc4d790bb
--- 1/git-send-email.perl
--- 2/git-send-email.perl
+++ b/git-send-email.perl
}
# Variables with corresponding config settings
- my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc, $cc_cmd);
+ my ($thread, $chain_reply_to, $suppress_from, $signed_off_by_cc);
+ my ($to_cmd, $cc_cmd);
-my ($smtp_server, $smtp_server_port, $smtp_authuser, $smtp_encryption);
-my ($identity, $aliasfiletype, @alias_files, @smtp_host_parts, $smtp_domain);
+my ($smtp_server, $smtp_server_port, @smtp_server_options);
+my ($smtp_authuser, $smtp_encryption);
+my ($identity, $aliasfiletype, @alias_files, $smtp_domain);
my ($validate, $confirm);
my (@suppress_cc);
my ($auto_8bit_encoding);
my %config_settings = (
"smtpserver" => \$smtp_server,
"smtpserverport" => \$smtp_server_port,
+ "smtpserveroption" => \@smtp_server_options,
"smtpuser" => \$smtp_authuser,
"smtppass" => \$smtp_authpass,
- "smtpdomain" => \$smtp_domain,
+ "smtpdomain" => \$smtp_domain,
"to" => \@to,
+ "tocmd" => \$to_cmd,
"cc" => \@initial_cc,
"cccmd" => \$cc_cmd,
"aliasfiletype" => \$aliasfiletype,
$c, $_) unless $quiet;
}
}
- close F;
+ close $fh;
- if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
- open my $fh, "$cc_cmd \Q$t\E |"
- or die "(cc-cmd) Could not execute '$cc_cmd'";
- while(my $c = <$fh>) {
- chomp $c;
- $c =~ s/^\s*//g;
- next if ($c eq $sender and $suppress_from);
- push @cc, $c;
- printf("(cc-cmd) Adding cc: %s from: '%s'\n",
- $c, $cc_cmd) unless $quiet;
- }
- close $fh
- or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
- }
+ push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
+ if defined $to_cmd;
+ push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
+ if defined $cc_cmd && !$suppress_cc{'cccmd'};
if ($broken_encoding{$t} && !$has_content_type) {
$has_content_type = 1;
$message_id = undef;
}
- open(F, "$cmd \Q$file\E |")
+ # Execute a command (e.g. $to_cmd) to get a list of email addresses
+ # and return a results array
+ sub recipients_cmd {
+ my ($prefix, $what, $cmd, $file) = @_;
+
+ my $sanitized_sender = sanitize_address($sender);
+ my @addresses = ();
- while(<F>) {
- my $address = $_;
++ open my $fh, "$cmd \Q$file\E |"
+ or die "($prefix) Could not execute '$cmd'";
- close F
++ while (my $address = <$fh>) {
+ $address =~ s/^\s*//g;
+ $address =~ s/\s*$//g;
+ $address = sanitize_address($address);
+ next if ($address eq $sanitized_sender and $suppress_from);
+ push @addresses, $address;
+ printf("($prefix) Adding %s: %s from: '%s'\n",
+ $what, $address, $cmd) unless $quiet;
+ }
++ close $fh
+ or die "($prefix) failed to close pipe to '$cmd'";
+ return @addresses;
+ }
+
cleanup_compose_files();
-sub cleanup_compose_files() {
+sub cleanup_compose_files {
unlink($compose_filename, $compose_filename . ".final") if $compose;
}
diff --cc t/t9001-send-email.sh
Simple merge