@matheusbsbs / matheus-bagliano / commits / dc1460aa8d
Fork 0

send-email: ask_default should apply to all emails, not just the first

Commit 6e18251 made the "Send this email?" prompt assume yes if confirm = "inform" when it was unable to get a valid response. However, the "yes" assumption only worked correctly for the first email. This commit fixes the issue and confirms the fix by modifying the existing test for the prompt to send multiple emails. Reported by Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jay Soffian committed Mar 31, 2009 at 12:22 UTC dc1460aa8de64f62b4612b6d2546ed7b88050de2
2 files changed +4 -3
git-send-email.perl
+1 -2
@@ -687,7 +687,7 @@ if ($compose && $compose > 0) {
687
688 # Variables we set as part of the loop over files
689 our ($message_id, %mail, $subject, $reply_to, $references, $message,
690 - $needs_confirm, $message_num);
690 + $needs_confirm, $message_num, $ask_default);
691
692 sub extract_valid_address {
693 my $address = shift;
@@ -845,7 +845,6 @@ X-Mailer: git-send-email $gitversion
845
846 if ($needs_confirm && !$dry_run) {
847 print "\n$header\n";
848 - my $ask_default;
848 if ($needs_confirm eq "inform") {
849 $confirm_unconfigured = 0; # squelch this message for the rest of this run
850 $ask_default = "y"; # assume yes on EOF since user hasn't explicitly asked for confirmation
t/t9001-send-email.sh
+3 -1
@@ -462,12 +462,14 @@ test_expect_success 'confirm by default (due to --compose)' '
462 test_expect_success 'confirm detects EOF (inform assumes y)' '
463 CONFIRM=$(git config --get sendemail.confirm) &&
464 git config --unset sendemail.confirm &&
465 + rm -fr outdir &&
466 + git format-patch -2 -o outdir &&
467 GIT_SEND_EMAIL_NOTTY=1 \
468 git send-email \
469 --from="Example <nobody@example.com>" \
470 --to=nobody@example.com \
471 --smtp-server="$(pwd)/fake.sendmail" \
470 - $patches < /dev/null
472 + outdir/*.patch < /dev/null
473 ret="$?"
474 git config sendemail.confirm ${CONFIRM:-never}
475 test $ret = "0"