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>
This commit is contained in:
parent
a271b2a9ce
commit
1e5aaa6db3
@ -187,8 +187,9 @@ update::
|
|||||||
"Update>>". When the prompt ends with double '>>', you can
|
"Update>>". When the prompt ends with double '>>', you can
|
||||||
make more than one selection, concatenated with whitespace or
|
make more than one selection, concatenated with whitespace or
|
||||||
comma. Also you can say ranges. E.g. "2-5 7,9" to choose
|
comma. Also you can say ranges. E.g. "2-5 7,9" to choose
|
||||||
2,3,4,5,7,9 from the list. You can say '*' to choose
|
2,3,4,5,7,9 from the list. If the second number in a range is
|
||||||
everything.
|
omitted, all remaining patches are taken. E.g. "7-" to choose
|
||||||
|
7,8,9 from the list. You can say '*' to choose everything.
|
||||||
+
|
+
|
||||||
What you chose are then highlighted with '*',
|
What you chose are then highlighted with '*',
|
||||||
like this:
|
like this:
|
||||||
|
@ -406,9 +406,9 @@ sub list_and_choose {
|
|||||||
if ($choice =~ s/^-//) {
|
if ($choice =~ s/^-//) {
|
||||||
$choose = 0;
|
$choose = 0;
|
||||||
}
|
}
|
||||||
# A range can be specified like 5-7
|
# A range can be specified like 5-7 or 5-.
|
||||||
if ($choice =~ /^(\d+)-(\d+)$/) {
|
if ($choice =~ /^(\d+)-(\d*)$/) {
|
||||||
($bottom, $top) = ($1, $2);
|
($bottom, $top) = ($1, length($2) ? $2 : 1 + @stuff);
|
||||||
}
|
}
|
||||||
elsif ($choice =~ /^\d+$/) {
|
elsif ($choice =~ /^\d+$/) {
|
||||||
$bottom = $top = $choice;
|
$bottom = $top = $choice;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user