aboutsummaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-04-04 23:23:21 -0400
committerJunio C Hamano <gitster@pobox.com>2009-04-04 22:53:32 -0700
commit0da43a685aa061f55ed19ea30e1d6220020059a6 (patch)
treea68c647131877ba36e148724fa160c190cfdac7c /git-send-email.perl
parente96f3689ecd95997a2a474c2b7f21b0a67f138b1 (diff)
downloadgit-0da43a685aa061f55ed19ea30e1d6220020059a6.tar.gz
git-0da43a685aa061f55ed19ea30e1d6220020059a6.tar.xz
send-email: fix nasty bug in ask() function
Commit 6e18251 (send-email: refactor and ensure prompting doesn't loop forever) introduced an ask function, which unfortunately had a nasty bug. This caused it not to accept anything but the default reply to the "Who should the emails appear to be from?" prompt, and nothing but ctrl-d to the "Who should the emails be sent to?" and "Message-ID to be used as In-Reply-To for the first email?" prompts. This commit corrects the issues and adds a test to confirm the fix. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 6bbdfec84..172b53c2d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -608,7 +608,7 @@ EOT
sub ask {
my ($prompt, %arg) = @_;
- my $valid_re = $arg{valid_re} || ""; # "" matches anything
+ my $valid_re = $arg{valid_re};
my $default = $arg{default};
my $resp;
my $i = 0;
@@ -624,7 +624,7 @@ sub ask {
if ($resp eq '' and defined $default) {
return $default;
}
- if ($resp =~ /$valid_re/) {
+ if (!defined $valid_re or $resp =~ /$valid_re/) {
return $resp;
}
}