{"thread":{"id":"10032","subject":"[PATCH 2/2] git-add--interactive: Improve behavior on bogus input","startedAt":"2007-09-26T14:05:01Z","lastAt":"2007-09-26T14:05:01Z","messageCount":1,"participants":["Jean-Luc Herren"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"54102","messageId":"46FA670D.1060205@gmx.ch","threadId":"10032","inReplyTo":null,"subject":"[PATCH 2/2] git-add--interactive: Improve behavior on bogus input","fromName":"Jean-Luc Herren","fromEmail":"jlh@gmx.ch","sentAt":"2007-09-26T14:05:01Z","receivedAt":"2007-09-26T14:05:01Z","isPatch":true,"sender":{"key":"jlh@gmx.ch","avatar":null},"body":"1) Previously, any menu would cause a perl error when entered '0',\n   which is never a valid option.\n\n2) Entering a bogus choice (like 998 or 4-2) surprisingly caused\n   the same behavior as if the user had just hit 'enter', which\n   means to carry out the selected action on the selected items.\n   Entering such bogus input is now a no-op and the sub-menu\n   doesn't exit.\n\nSigned-off-by: Jean-Luc Herren <jlh@gmx.ch>\n---\n git-add--interactive.perl |    7 +++----\n 1 files changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex f9e9f02..be68814 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -219,7 +219,7 @@ sub list_and_choose {\n \t\t\tlast;\n \t\t}\n \t\tchomp $line;\n-\t\tmy $donesomething = 0;\n+\t\tlast if $line eq '';\n \t\tfor my $choice (split(/[\\s,]+/, $line)) {\n \t\t\tmy $choose = 1;\n \t\t\tmy ($bottom, $top);\n@@ -251,12 +251,11 @@ sub list_and_choose {\n \t\t\t\tnext TOPLOOP;\n \t\t\t}\n \t\t\tfor ($i = $bottom-1; $i <= $top-1; $i++) {\n-\t\t\t\tnext if (@stuff <= $i);\n+\t\t\t\tnext if (@stuff <= $i || $i < 0);\n \t\t\t\t$chosen[$i] = $choose;\n-\t\t\t\t$donesomething++;\n \t\t\t}\n \t\t}\n-\t\tlast if (!$donesomething || $opts->{IMMEDIATE});\n+\t\tlast if ($opts->{IMMEDIATE});\n \t}\n \tfor ($i = 0; $i < @stuff; $i++) {\n \t\tif ($chosen[$i]) {\n-- \n1.5.3\n"}]}