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

Re: [PATCH] blame: prevent error if range ends past end of file

From
Isabella Stephens <istephens@atlassian.com>
Date
May 31, 2018, 05:07 UTC
Message-ID
<6c715a0c-2ad1-b2dc-d3d5-d4175632236c@atlassian.com>
In-Reply-To
<CAPig+cTCDP0zJonDFXyv6Kue5y4PMPaveyjfvfTVNoifzYg-Og@mail.gmail.com>
On 30/5/18 6:45 pm, Eric Sunshine wrote:
Show 32 quoted lines
>> diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
>> @@ -152,6 +152,16 @@ Also you can use a regular expression to specify the line range:
>>  which limits the annotation to the body of the `hello` subroutine.
>>
>> +A range that begins or ends outside the bounds of the file will
>> +blame the relevant lines. For example:
>> +
>> +       git blame -L 10,-20 foo
>> +       git blame -L 10,+20 foo
>> +
>> +will respectively blame the first 10 and last 11 lines of a
>> +20 line file. However, blaming a line range that is entirely
>> +outside the bounds of the file will fail.
> 
> This documentation seems misplaced. Rather than inserting it after the
> discussion of -L/regex/, a more natural place would be just above
> -L/regex/ where -L<begin>,<end> is discussed.
> 
> However, I am not at all convinced that this behavior should be
> documented to this level of detail. Doing so assigns too much emphasis
> to what should be intuitive, thus wastes readers' time wondering why
> it is so heavily emphasized. At _most_, I would think you could say
> merely:
> 
>     A range that begins or ends outside the bounds of the file
>     will be clipped to the file's extent.
> 
> and drop the example and discussion of the example results altogether.
> 
> In fact, because this new behavior is what most users will intuitively
> expect, it might be perfectly reasonable to not say anything about it
> at all (that is, don't modify git-blame.txt)

Thanks for reviewing Eric. I've submitted a v6 patch in response to your feedback.

I agree that given the behavior is intuitive it's not necessary to document this change, so I've reverted the change to git-blame.txt entirely.

Previous: Eric SunshineNext: istephens@atlassian.com
Message 23 of 27 in “blame: add --fuzzy-lines command line option”
  1. blame: add --fuzzy-lines command line optionIsabella Stephens, Oct 26, 2017
  2. Junio C HamanoOct 26, 2017
  3. blame: prevent error if range ends past end of fileIsabella Stephens, Oct 26, 2017
  4. Jacob KellerOct 26, 2017
  5. Isabella StephensOct 26, 2017
  6. SZEDER GáborOct 26, 2017
  7. Isabella StephensOct 26, 2017
  8. blame: prevent error if range ends past end of fileIsabella Stephens, Oct 27, 2017
  9. Junio C HamanoOct 27, 2017
  10. Junio C HamanoOct 27, 2017
  11. Isabella StephensOct 27, 2017
  12. Eric SunshineOct 27, 2017
  13. 0/2 blame and log: prevent error if range ends past end of fileistephens@atlassian.com, Apr 26, 2018
  14. 1/2 blame: prevent error if range ends past end of fileistephens@atlassian.com, Apr 26, 2018
  15. Junio C HamanoApr 27, 2018
  16. Isabella StephensApr 27, 2018
  17. Junio C HamanoApr 27, 2018
  18. Isabella StephensApr 27, 2018
  19. Junio C HamanoMay 2, 2018
  20. 0/2 blame and log: prevent error if range ends past end of fileistephens@atlassian.com, May 29, 2018
  21. blame: prevent error if range ends past end of fileistephens@atlassian.com, May 29, 2018
  22. Eric SunshineMay 30, 2018
  23. Isabella StephensMay 31, 2018
  24. log: prevent error if line range ends past end of fileistephens@atlassian.com, May 29, 2018
  25. Eric SunshineMay 30, 2018
  26. 2/2 log: prevent error if line range ends past end of fileistephens@atlassian.com, Apr 26, 2018
  27. Isabella StephensOct 26, 2017

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.