Re: [BUG?] blame: Odd -L 1,+0 behavior
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 16, 2010, 21:25 UTC
- Message-ID
- <AANLkTinSO3S4hjuvzSOfEBwBEL8_amk7uM2-_LKMtE8k@mail.gmail.com>
- In-Reply-To
- <7vy6dbqghl.fsf@alter.siamese.dyndns.org>
On Fri, Jul 16, 2010 at 21:11, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > >> ok, +/- are zero-indexed: >> >> $ git blame -L 1,+2 cow > > I don't know what "zero-indexed" means, but +2 means "starting from the > line I told you earlier, give me two lines". Likewise -2 means "ending at > the line I told you earlier, give me two lines".
From just using it I parsed 1,+1 as "give me line #1 plus $n-1 lines". At first I thought 1,+1 would print two lines (line 1 *plus* one). But it makes sense when you explain it.
> As a side effect of the internal implementation of this logic -L 5,3 > means the same thing as -L 3,5 but that is not an intended nor > documented behaviour.
How should L 5,3 and 3,5 work? Should the former give an error?
Show 8 quoted lines
>> Shouldn't this either print nothing, er be an error: > (multiple) > > The parsing code is lax in the sense that rejecting nonsensical input like > "-L 10,-100" and "-L 2,+0" as an error was not considered a primary goal. > The only error checking it does is to make sure it does not parse numbers > that it cannot use (i.e. start from line 30 in a file that does not have > that many lines).
Do you want a patch to make it less lax?