зеркало из https://github.com/microsoft/git.git
send-email: do not pass bogus address to local sendmail binary
This makes t9001 test happy. Also fixes the warning on uninitialized $references variable again. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
ce903018f1
Коммит
2186d566a6
|
@ -387,7 +387,9 @@ X-Mailer: git-send-email $gitversion
|
||||||
my $pid = open my $sm, '|-';
|
my $pid = open my $sm, '|-';
|
||||||
defined $pid or die $!;
|
defined $pid or die $!;
|
||||||
if (!$pid) {
|
if (!$pid) {
|
||||||
exec($smtp_server,'-i',@recipients) or die $!;
|
exec($smtp_server,'-i',
|
||||||
|
map { scalar extract_valid_address($_) }
|
||||||
|
@recipients) or die $!;
|
||||||
}
|
}
|
||||||
print $sm "$header\n$message";
|
print $sm "$header\n$message";
|
||||||
close $sm or die $?;
|
close $sm or die $?;
|
||||||
|
@ -420,7 +422,7 @@ X-Mailer: git-send-email $gitversion
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply_to = $initial_reply_to;
|
$reply_to = $initial_reply_to;
|
||||||
$references = $initial_reply_to;
|
$references = $initial_reply_to || '';
|
||||||
make_message_id();
|
make_message_id();
|
||||||
$subject = $initial_subject;
|
$subject = $initial_subject;
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,14 @@ test_expect_success \
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'Setup helper tool' \
|
'Setup helper tool' \
|
||||||
'echo "#!/bin/sh" > fake.sendmail
|
'(echo "#!/bin/sh"
|
||||||
echo "shift" >> fake.sendmail
|
echo shift
|
||||||
echo "echo \"\$*\" > commandline" >> fake.sendmail
|
echo for a
|
||||||
echo "cat > msgtxt" >> fake.sendmail
|
echo do
|
||||||
|
echo " echo \"!\$a!\""
|
||||||
|
echo "done >commandline"
|
||||||
|
echo "cat > msgtxt"
|
||||||
|
) >fake.sendmail
|
||||||
chmod +x ./fake.sendmail
|
chmod +x ./fake.sendmail
|
||||||
git add fake.sendmail
|
git add fake.sendmail
|
||||||
GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
|
GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
|
||||||
|
@ -26,9 +30,12 @@ test_expect_success \
|
||||||
'git format-patch -n HEAD^1
|
'git format-patch -n HEAD^1
|
||||||
git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
|
git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
|
||||||
|
|
||||||
|
cat >expected <<\EOF
|
||||||
|
!nobody@example.com!
|
||||||
|
!author@example.com!
|
||||||
|
EOF
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'Verify commandline' \
|
'Verify commandline' \
|
||||||
'cline=$(cat commandline)
|
'diff commandline expected'
|
||||||
[ "$cline" == "nobody@example.com author@example.com" ]'
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Загрузка…
Ссылка в новой задаче