summaryrefslogtreecommitdiffstats
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorJean-Luc Herren <jlh@gmx.ch>2007-09-26 16:05:01 +0200
committerJunio C Hamano <gitster@pobox.com>2007-09-30 08:14:17 +0200
commit6a6eb3d09fcbfae41978fb5223ae03e2d103968b (patch)
tree9df1c29c17e15e787d9d1d0a41b5266dedffb0a2 /git-add--interactive.perl
parentgit-add--interactive: Allow Ctrl-D to exit (diff)
downloadgit-6a6eb3d09fcbfae41978fb5223ae03e2d103968b.tar.xz
git-6a6eb3d09fcbfae41978fb5223ae03e2d103968b.zip
git-add--interactive: Improve behavior on bogus input
1) Previously, any menu would cause a perl error when entered '0', which is never a valid option. 2) Entering a bogus choice (like 998 or 4-2) surprisingly caused the same behavior as if the user had just hit 'enter', which means to carry out the selected action on the selected items. Entering such bogus input is now a no-op and the sub-menu doesn't exit. Signed-off-by: Jean-Luc Herren <jlh@gmx.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl7
1 files changed, 3 insertions, 4 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index f9e9f02392..be6881496c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -219,7 +219,7 @@ sub list_and_choose {
last;
}
chomp $line;
- my $donesomething = 0;
+ last if $line eq '';
for my $choice (split(/[\s,]+/, $line)) {
my $choose = 1;
my ($bottom, $top);
@@ -251,12 +251,11 @@ sub list_and_choose {
next TOPLOOP;
}
for ($i = $bottom-1; $i <= $top-1; $i++) {
- next if (@stuff <= $i);
+ next if (@stuff <= $i || $i < 0);
$chosen[$i] = $choose;
- $donesomething++;
}
}
- last if (!$donesomething || $opts->{IMMEDIATE});
+ last if ($opts->{IMMEDIATE});
}
for ($i = 0; $i < @stuff; $i++) {
if ($chosen[$i]) {