Merge branch 'ew/send-email-mutt-alias-fix'

"git send-email" was confused by escaped quotes stored in the alias
files saved by "mutt", which has been corrected.

* ew/send-email-mutt-alias-fix:
  git-send-email: do not double-escape quotes from mutt
This commit is contained in:
Junio C Hamano 2016-01-20 11:43:28 -08:00
Родитель 7e3e80a881 2c510f21cd
Коммит 63aeeba993
2 изменённых файлов: 22 добавлений и 2 удалений

Просмотреть файл

@ -525,7 +525,12 @@ my %parse_alias = (
my ($alias, $addr) = ($1, $2);
$addr =~ s/#.*$//; # mutt allows # comments
# commas delimit multiple addresses
$aliases{$alias} = [ split_addrs($addr) ];
my @addr = split_addrs($addr);
# quotes may be escaped in the file,
# unescape them so we do not double-escape them later.
s/\\"/"/g foreach @addr;
$aliases{$alias} = \@addr
}}},
mailrc => sub { my $fh = shift; while (<$fh>) {
if (/^alias\s+(\S+)\s+(.*)$/) {

Просмотреть файл

@ -1527,6 +1527,21 @@ test_expect_success $PREREQ 'cccover adds Cc to all mail' '
test_cover_addresses "Cc"
'
test_expect_success $PREREQ 'escaped quotes in sendemail.aliasfiletype=mutt' '
clean_fake_sendmail &&
echo "alias sbd \\\"Dot U. Sir\\\" <somebody@example.org>" >.mutt &&
git config --replace-all sendemail.aliasesfile "$(pwd)/.mutt" &&
git config sendemail.aliasfiletype mutt &&
git send-email \
--from="Example <nobody@example.com>" \
--to=sbd \
--smtp-server="$(pwd)/fake.sendmail" \
outdir/0001-*.patch \
2>errors >out &&
grep "^!somebody@example\.org!$" commandline1 &&
grep -F "To: \"Dot U. Sir\" <somebody@example.org>" out
'
test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
clean_fake_sendmail &&
echo "alias sbd somebody@example.org" >.mailrc &&