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

Re: [PATCH 3/3] completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'

From
Jeff King <peff@peff.net>
Date
Apr 1, 2017, 08:50 UTC
Message-ID
<20170401085058.y7u73x6beqgnhrcb@sigill.intra.peff.net>
In-Reply-To
<20170330100656.18766-1-szeder.dev@gmail.com>
On Thu, Mar 30, 2017 at 12:06:56PM +0200, SZEDER Gábor wrote:
Show 6 quoted lines
> >   1. You still have to come up with the filename yourself for "-L".
> 
> I was already quite satisfied that both the symbol name and the 
> filename can be TAB completed...  but right, in most cases the
> function name uniquely determines the filename, and even when it
> doesn't, it still significantly limits the possibilities.  Hmhm.

I find that I often forget which file a function is defined in, especially in Git's code base (where it sometimes feels somewhat random :) ).

Show 7 quoted lines
> OTOH, the proof-of-concept patch at the bottom shows how we could
> start doing filename completion based on the ctags file, and I think
> it's really convenient to use.  Alas, it doesn't work when the
> funcname is not on its own, e.g. ends with that disambiguating '\(:'
> from above, and then Bash falls back to its own filename completion.
> However, if I may extrapolate from my ~/.bash_history, this would
> still help the great majority of the cases.
Yeah, I think that would go a long way to solving my problem.
Show 11 quoted lines
> > I have a script (below) which makes this easier (and I complete its
> > argument using the tags file).  It's probably too gross to even go into
> > contrib, but I thought I'd share.
> 
> Perhaps 'git log -L' could be enhanced to just DWIM when it gets only
> '-L:func:', and show the log of that function, wherever it is defined.
> So instead of complaining about the missing filename, it could run
> 'grep <func>' with a bit of magic to find the filename where the
> matching function is declared, and search in the history of that file.
> 
> But then again, 'git log -L' could be enhanced in so many ways...
Yes, that sounds even nicer.
-Peff
Previous: SZEDER Gábor
Message 9 of 9 in “completion: updates to ctags symbol names”
  1. 0/3 completion: updates to ctags symbol namesSZEDER Gábor, Mar 23, 2017
  2. 1/3 completion: put matching ctags symbol names directly into COMPREPLYSZEDER Gábor, Mar 23, 2017
  3. Jeff KingMar 24, 2017
  4. 2/3 completion: extract completing ctags symbol names into helper functionSZEDER Gábor, Mar 23, 2017
  5. Jeff KingMar 24, 2017
  6. 3/3 completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'SZEDER Gábor, Mar 23, 2017
  7. Jeff KingMar 24, 2017
  8. SZEDER GáborMar 30, 2017
  9. Jeff KingApr 1, 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.