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

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 16, 2010, 15:50 UTC
Message-ID
<AANLkTin-6nck9aVKPTwOy_PmrGUs1iS8ruqzIORbf8jb@mail.gmail.com>
On Fri, Jul 16, 2010 at 15:35, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> git-pickaxe (later git-blame) gained support for the -L/start/,/end/
> form in 2006 (931233bc66 by Junio C Hamano), but nothing was added to
> test this functionality. Change that by adding more -L tests to
> t8003-blame.sh.

I was also going to patch t8003-blame.sh to test for the functionality introduced in 7bd9641df5, but I'm not sure what it's supposed to do:

ok:
    $ git blame cow
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 1) ABC
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 2) DEF
    018e3134 (Fifth  2005-04-07 15:17:13 -0700 3) XXXX
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 4) GHIJK
ok:
    $ git blame -L 1,2 cow
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 1) ABC
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 2) DEF
ok, +/- are zero-indexed:
    $ git blame -L 1,+2 cow
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 1) ABC
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 2) DEF
Shouldn't this either print nothing, er be an error:
    $ git blame -L 1,+0 cow
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 1) ABC
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 2) DEF
same here, line 0-0 prints the whole file:
    $ git blame -L 0,0 cow
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 1) ABC
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 2) DEF
    018e3134 (Fifth  2005-04-07 15:17:13 -0700 3) XXXX
    5b22ca36 (Fourth 2005-04-07 15:16:13 -0700 4) GHIJK
And these need a better error message:
    $ git blame -L 0,0a cow
    usage: git blame [options] [rev-opts] [rev] [--] file
Is there any use for +/- 0, or should it always be an error?
Next: Junio C Hamano
Message 1 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.