git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG?] blame: Odd -L 1,+0 behavior

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 16, 2010, 22:33 UTC
Message-ID
<7vmxtrqcpl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTinSO3S4hjuvzSOfEBwBEL8_amk7uM2-_LKMtE8k@mail.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 5 quoted lines
>> 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?

"-L 3,5" would choose "lines 3,4, and 5" (both ends inclusive). Currently "-L 5,3" does the same thing but as I said, that is not an intended nor documented behaviour, and if you are tackling this area to tighten the parsing and error diagnosis, I think it is reasonable to error it out.

Show 10 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?
Be my guest ;-)  Thanks.
Previous: Ævar Arnfjörð Bjarmason
Message 4 of 4 in “[BUG?] blame: Odd -L 1,+0 behavior”
  1. Ævar Arnfjörð BjarmasonJul 16, 2010
  2. Junio C HamanoJul 16, 2010
  3. Ævar Arnfjörð BjarmasonJul 16, 2010
  4. Junio C HamanoJul 16, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.