diff options
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-x | git-add--interactive.perl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 7921cde8cb..be6881496c 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -213,9 +213,13 @@ sub list_and_choose { print ">> "; } my $line = <STDIN>; - last if (!$line); + if (!$line) { + print "\n"; + $opts->{ON_EOF}->() if $opts->{ON_EOF}; + last; + } chomp $line; - my $donesomething = 0; + last if $line eq ''; for my $choice (split(/[\s,]+/, $line)) { my $choose = 1; my ($bottom, $top); @@ -247,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]) { @@ -791,6 +794,7 @@ sub main_loop { SINGLETON => 1, LIST_FLAT => 4, HEADER => '*** Commands ***', + ON_EOF => \&quit_cmd, IMMEDIATE => 1 }, @cmd); if ($it) { eval { |