diff options
-rwxr-xr-x | git-send-email.perl | 4 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index 6bbdfec849..172b53c2d5 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; } } diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 192b97b2d6..3c90c4fc1c 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -130,6 +130,19 @@ test_expect_success 'Show all headers' ' test_cmp expected-show-all-headers actual-show-all-headers ' +test_expect_success 'Prompting works' ' + clean_fake_sendmail && + (echo "Example <from@example.com>" + echo "to@example.com" + echo "" + ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \ + --smtp-server="$(pwd)/fake.sendmail" \ + $patches \ + 2>errors && + grep "^From: Example <from@example.com>$" msgtxt1 && + grep "^To: to@example.com$" msgtxt1 +' + z8=zzzzzzzz z64=$z8$z8$z8$z8$z8$z8$z8$z8 z512=$z64$z64$z64$z64$z64$z64$z64$z64 |