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

Re: phpdoc diff in git -L is not the correct one

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Nov 14, 2020, 17:35 UTC
Message-ID
<CAN0heSr9=_So-sUhQN86vawBEkJhnrHHsd3OcSYZMZ-idZGFAQ@mail.gmail.com>
In-Reply-To
<e666e806-d8c6-0b8d-c583-e4a8ee0ee806@greg0ire.fr>
Hi,
On Sat, 14 Nov 2020 at 16:55, Grégoire PARIS <postmaster@greg0ire.fr> wrote:
Show 9 quoted lines
> > In the end I think your best option right now is to give explicit line
> > numbers for <end> and <start>.
> That is indeed what I currently do, I plugged that to vim's visual
> selection with
>
>    vnoremap <leader>l :<c-u>exe '!git log -L'
> line("'<").','.line("'>").':'.expand('%')<CR>
>
> and it works great!
Great!
> I also suppose the issue is the same for any other language that has
> documentation above function declarations.

Yeah, you'll see the same thing for C files, e.g., using this in the repo of Git itself:

  git log -L :strbuf_swap:strbuf.h

It will follow the lines from the function definition all the way down to the next function, but just as you saw in your example, it will not match the comment immediately *before* the function. That is, these lines will be followed:

  https://github.com/git/git/blob/v2.29.2/strbuf.h#L125-L138
Martin
Previous: Grégoire PARISNext: René Scharfe
Message 4 of 7 in “phpdoc diff in git -L is not the correct one”
  1. Grégoire PARISNov 14, 2020
  2. Martin ÅgrenNov 14, 2020
  3. Grégoire PARISNov 14, 2020
  4. Martin ÅgrenNov 14, 2020
  5. René ScharfeNov 14, 2020
  6. Grégoire PARISNov 18, 2020
  7. Martin ÅgrenNov 18, 2020

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.