Skip to content

Commit

Permalink
send-email: ask_default should apply to all emails, not just the first
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jay Soffian authored and Junio C Hamano committed Apr 1, 2009
1 parent 5906f54 commit dc1460a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ sub expand_aliases {

# Variables we set as part of the loop over files
our ($message_id, %mail, $subject, $reply_to, $references, $message,
$needs_confirm, $message_num);
$needs_confirm, $message_num, $ask_default);

sub extract_valid_address {
my $address = shift;
Expand Down Expand Up @@ -845,7 +845,6 @@ sub send_message

if ($needs_confirm && !$dry_run) {
print "\n$header\n";
my $ask_default;
if ($needs_confirm eq "inform") {
$confirm_unconfigured = 0; # squelch this message for the rest of this run
$ask_default = "y"; # assume yes on EOF since user hasn't explicitly asked for confirmation
Expand Down
4 changes: 3 additions & 1 deletion t/t9001-send-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,14 @@ test_expect_success 'confirm by default (due to --compose)' '
test_expect_success 'confirm detects EOF (inform assumes y)' '
CONFIRM=$(git config --get sendemail.confirm) &&
git config --unset sendemail.confirm &&
rm -fr outdir &&
git format-patch -2 -o outdir &&
GIT_SEND_EMAIL_NOTTY=1 \
git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$patches < /dev/null
outdir/*.patch < /dev/null
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
Expand Down

0 comments on commit dc1460a

Please sign in to comment.