aboutsummaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorCiaran McCreesh <ciaran.mccreesh@googlemail.com>2008-07-14 19:29:37 +0100
committerJunio C Hamano <gitster@pobox.com>2008-08-01 23:26:40 -0700
commit69c231f4732e1373f7872dde6dc50ffe62673865 (patch)
tree1efa2c6775b46ef0fcd5c85a5f9bc84fd4874069 /git-add--interactive.perl
parent1ceb95c8041cad1c25c73fd08e8c0c7ee28cf704 (diff)
downloadgit-69c231f4732e1373f7872dde6dc50ffe62673865.tar.gz
git-69c231f4732e1373f7872dde6dc50ffe62673865.tar.xz
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 <ciaran.mccreesh@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 903953e68..709caa905 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -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;