Make git-add -i accept ranges like 7-
[gitweb.git] / git-add--interactive.perl
index 903953e68e98535e754b5a5dd6ba22eb6074ef20..709caa9055e139731bedd8b4e0b2659df6017bfa 100755 (executable)
@@ -394,9 +394,9 @@ sub list_and_choose {
                        if ($choice =~ s/^-//) {
                                $choose = 0;
                        }
-                       # A range can be specified like 5-7
-                       if ($choice =~ /^(\d+)-(\d+)$/) {
-                               ($bottom, $top) = ($1, $2);
+                       # A range can be specified like 5-7 or 5-.
+                       if ($choice =~ /^(\d+)-(\d*)$/) {
+                               ($bottom, $top) = ($1, length($2) ? $2 : 1 + @stuff);
                        }
                        elsif ($choice =~ /^\d+$/) {
                                $bottom = $top = $choice;