diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2008-12-19 16:10:10 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-19 19:10:48 -0800 |
commit | 0e73b3ee6ca95e1db2fe801d2b8544f4c27991df (patch) | |
tree | 5f67dc706abbdc18295a0a35f82567251ca2b21e /git-send-email.perl | |
parent | 04c8ce9c1c803a8dc0f3728f57550f9bc9e605c2 (diff) | |
download | git-0e73b3ee6ca95e1db2fe801d2b8544f4c27991df.tar.gz git-0e73b3ee6ca95e1db2fe801d2b8544f4c27991df.tar.xz |
git-send-email: handle email address with quoted comma
Correctly handle email addresses containing quoted commas, e.g.
"Zhu, Yi" <yi.zhu@intel.com>, "Li, Shaohua" <shaohua.li@intel.com>
The commas inside the double quotes are not separators.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index 18529c76e..449d938ba 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -20,6 +20,7 @@ use strict; use warnings; use Term::ReadLine; use Getopt::Long; +use Text::ParseWords; use Data::Dumper; use Term::ANSIColor; use Git; @@ -363,6 +364,10 @@ foreach my $entry (@bcclist) { die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; } +sub split_addrs { + return parse_line('\s*,\s*', 1, @_); +} + my %aliases; my %parse_alias = ( # multiline formats can be supported in the future @@ -371,7 +376,7 @@ my %parse_alias = ( my ($alias, $addr) = ($1, $2); $addr =~ s/#.*$//; # mutt allows # comments # commas delimit multiple addresses - $aliases{$alias} = [ split(/\s*,\s*/, $addr) ]; + $aliases{$alias} = [ split_addrs($addr) ]; }}}, mailrc => sub { my $fh = shift; while (<$fh>) { if (/^alias\s+(\S+)\s+(.*)$/) { @@ -380,7 +385,7 @@ my %parse_alias = ( }}}, pine => sub { my $fh = shift; while (<$fh>) { if (/^(\S+)\t.*\t(.*)$/) { - $aliases{$1} = [ split(/\s*,\s*/, $2) ]; + $aliases{$1} = [ split_addrs($2) ]; }}}, gnus => sub { my $fh = shift; while (<$fh>) { if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) { @@ -458,7 +463,7 @@ if (!@to) { } my $to = $_; - push @to, split /,\s*/, $to; + push @to, split_addrs($to); $prompting++; } |