aboutsummaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorStephen Boyd <bebarino@gmail.com>2010-10-04 00:05:24 -0700
committerJunio C Hamano <gitster@pobox.com>2010-10-04 00:12:13 -0700
commit3c3bb51c3b205a6838b022896c9323d4b25bf392 (patch)
tree03eb8b996e1d3f851843139d20c33c7921adfa9b /git-send-email.perl
parent21802cd32805b19fa32e8e3594ee3914733d53d3 (diff)
downloadgit-3c3bb51c3b205a6838b022896c9323d4b25bf392.tar.gz
git-3c3bb51c3b205a6838b022896c9323d4b25bf392.tar.xz
send-email: Don't leak To: headers between patches
If the first patch in a series has a To: header in the file and the second patch in the series doesn't the address from the first patch will be part of the To: addresses in the second patch. Fix this by treating the to list like the cc list. Have an initial to list come from the command line, user input and config options. Then build up a to list from each patch and concatenate the two together before sending the patch. Finally, reset the list after sending each patch so the To: headers from a patch don't get used for the next one. Reported-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl18
1 files changed, 10 insertions, 8 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index d6028ec7b..7f9eacd16 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -138,7 +138,7 @@ sub unique_email_list(@);
sub cleanup_compose_files();
# Variables we fill in automatically, or via prompting:
-my (@to,$no_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
+my (@to,$no_to,@initial_to,@cc,$no_cc,@initial_cc,@bcclist,$no_bcc,@xh,
$initial_reply_to,$initial_subject,@files,
$author,$sender,$smtp_authpass,$annotate,$compose,$time);
@@ -213,7 +213,7 @@ my %config_settings = (
"smtpuser" => \$smtp_authuser,
"smtppass" => \$smtp_authpass,
"smtpdomain" => \$smtp_domain,
- "to" => \@to,
+ "to" => \@initial_to,
"cc" => \@initial_cc,
"cccmd" => \$cc_cmd,
"aliasfiletype" => \$aliasfiletype,
@@ -271,7 +271,7 @@ $SIG{INT} = \&signal_handler;
my $rc = GetOptions("sender|from=s" => \$sender,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
- "to=s" => \@to,
+ "to=s" => \@initial_to,
"no-to" => \$no_to,
"cc=s" => \@initial_cc,
"no-cc" => \$no_cc,
@@ -409,7 +409,7 @@ my ($repoauthor, $repocommitter);
# Verify the user input
-foreach my $entry (@to) {
+foreach my $entry (@initial_to) {
die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
}
@@ -711,9 +711,9 @@ if (!defined $sender) {
$prompting++;
}
-if (!@to) {
+if (!@initial_to) {
my $to = ask("Who should the emails be sent to? ");
- push @to, parse_address_line($to) if defined $to; # sanitized/validated later
+ push @initial_to, parse_address_line($to) if defined $to; # sanitized/validated later
$prompting++;
}
@@ -731,8 +731,8 @@ sub expand_one_alias {
return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
}
-@to = expand_aliases(@to);
-@to = (map { sanitize_address($_) } @to);
+@initial_to = expand_aliases(@initial_to);
+@initial_to = (map { sanitize_address($_) } @initial_to);
@initial_cc = expand_aliases(@initial_cc);
@bcclist = expand_aliases(@bcclist);
@@ -1136,6 +1136,7 @@ foreach my $t (@files) {
my $author_encoding;
my $has_content_type;
my $body_encoding;
+ @to = ();
@cc = ();
@xh = ();
my $input_format = undef;
@@ -1300,6 +1301,7 @@ foreach my $t (@files) {
($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
+ @to = (@initial_to, @to);
@cc = (@initial_cc, @cc);
my $message_was_sent = send_message();