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

Re: [PATCH] blame: allow -L n,m to have an m bigger than the file's line count

From
SGSZEDER Gábor <szeder@fzi.de>
Date
Feb 10, 2010, 12:42 UTC
Message-ID
<20100210124238.GA31978@neumann>
In-Reply-To
<1265786864-5460-1-git-send-email-bebarino@gmail.com>
Hi Stephen,
On Tue, Feb 09, 2010 at 11:27:44PM -0800, Stephen Boyd wrote:
Show 49 quoted lines
> Sometimes I want to blame a file starting at some point and ending at
> the end of the file. In my haste I'll write something like this:
> 
> $ git blame -L5,2342343 -- builtin-blame.c
> 
> and be greeted by a die message telling me that my end range is greater
> than the number of lines in the file. Obviously I can do:
> 
> $ git blame -L5, -- builtin-blame.c
> 
> and get what I want but that isn't very discoverable. If the range is
> greater than the number of lines just truncate the range to go up to
> the end of the file.
> 
> Update the docs to more accurately reflect the defaults for n and m too.
> 
> Signed-off-by: Stephen Boyd <bebarino@gmail.com>
> ---
> 
> I realize this is late in the game for 1.7.0 so I'll resend if this
> isn't picked up.
> 
>  Documentation/blame-options.txt |    4 +++-
>  builtin-blame.c                 |    4 +++-
>  t/t8003-blame.sh                |    4 ++--
>  3 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
> index 4833cac..620660d 100644
> --- a/Documentation/blame-options.txt
> +++ b/Documentation/blame-options.txt
> @@ -9,7 +9,7 @@
>  --show-stats::
>  	Include additional statistics at the end of blame output.
>  
> --L <start>,<end>::
> +-L [<start>],[<end>]::
>  	Annotate only the given line range.  <start> and <end> can take
>  	one of these forms:
>  
> @@ -31,6 +31,8 @@ starting at the line given by <start>.
>  This is only valid for <end> and will specify a number
>  of lines before or after the line given by <start>.
>  +
> +Note: if <start> is not given it defaults to 1 and if <end> is not given it
> +defaults to the number of lines in the file.
>  
>  -l::
>  	Show long rev (Default: off).

I agree that its too late for the behavioral change, but IMHO the documentation update part can be considered as a bugfix, and as such it could perhaps be included in 1.7.0. (I never knew that <start> or <end> can be omitted... so thanks for the hint anyway)

Best, Gábor

Previous: Stephen BoydNext: Jay Soffian
Message 2 of 9 in “blame: allow -L n,m to have an m bigger than the file's line count”
  1. blame: allow -L n,m to have an m bigger than the file's line countStephen Boyd, Feb 10, 2010
  2. SZEDER GáborFeb 10, 2010
  3. Jay SoffianFeb 10, 2010
  4. Stephen BoydFeb 10, 2010
  5. Junio C HamanoFeb 10, 2010
  6. Jay SoffianFeb 10, 2010
  7. Junio C HamanoFeb 10, 2010
  8. Jay SoffianFeb 10, 2010
  9. Junio C HamanoFeb 12, 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.