summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e96f368)
raw | patch | inline | side by side (parent: e96f368)
author | Jay Soffian <jaysoffian@gmail.com> | |
Sun, 5 Apr 2009 03:23:21 +0000 (23:23 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 5 Apr 2009 05:53:32 +0000 (22:53 -0700) |
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>
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>
git-send-email.perl | patch | blob | history | |
t/t9001-send-email.sh | patch | blob | history |
diff --git a/git-send-email.perl b/git-send-email.perl
index 6bbdfec84983b23d3ab380e63975987b6078b4ca..172b53c2d5b8ccad6a1bee592bccbe27d8f3127c 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
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;
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 192b97b2d6cdc16045e5c71b7beaf03713e6a631..3c90c4fc1c0ee798b5e37729d1a67018499f0a92 100755 (executable)
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
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