From 1e5aaa6db38964fd6ca679864c0a40f7af01cf1a Mon Sep 17 00:00:00 2001 From: Ciaran McCreesh Date: Mon, 14 Jul 2008 19:29:37 +0100 Subject: Make git-add -i accept ranges like 7- git-add -i ranges expect number-number. But for the supremely lazy, typing in that second number when selecting "from patch 7 to the end" is wasted effort. So treat an empty second number in a range as "until the last item". Signed-off-by: Ciaran McCreesh Signed-off-by: Junio C Hamano --- git-add--interactive.perl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git-add--interactive.perl') diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 801d7c0251..a6a5c52b59 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -406,9 +406,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; -- cgit v1.2.1