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

Re: Long names for `git log -S` and `git log -G`

From
Jeff King <peff@peff.net>
Date
Nov 19, 2024, 18:58 UTC
Message-ID
<20241119185817.GC15723@coredump.intra.peff.net>
In-Reply-To
<xmqqo72bev71.fsf@gitster.g>
On Tue, Nov 19, 2024 at 12:52:50PM +0900, Junio C Hamano wrote:
Show 6 quoted lines
> 
> > `--pickaxe-grep` for `-G` seems like a reasonable alternative name for `-G`.
> 
> That is probably OK (even though "-G" is not exactly what the
> pickaxe machinery wants to do; "--grep-in-patch" might be closer to
> the intent).

FWIW, I like --grep-in-patch. Saying just "--pickaxe-grep" does not highlight that it is about looking in the patch. I.e., it is not clear from the name that is different from "-Sfoo --pickaxe-regex".

Show 12 quoted lines
> The -S feature was written to become one of the building blocks of
> Linus's "clearly superior algorithm", described in [1].  Linus talks
> about "where did this _line_ come from?", but the algorithm is more
> generally about a block of code.  The expected use case is for -S to
> be fed sufficiently unique block of text so that we can efficiently
> detect the transition of occurence count from 1 (because wee start
> from sufficiently unique block of code) down to 0 (which is the
> boundary in history where the block of code was first introduced in
> its current form).  It detects any occurence count change, but its
> primary focus is to find a transition from 1 to 0 (when going
> backwards in history).  Its spirit is more about "finding where it
> appeared in its current shape".

Heh. I do not disagree that was the original focus, but I find that I use "-S" most frequently to find mentions of a particular function or other token across the code base. E.g., understanding the historical uses of a function, or why it has no callers anymore, and so on. So I am often looking for many appearances or disappearances (though of course they may or may not happen in a single file).

-Peff
Previous: Junio C HamanoNext: Illia Bobyr
Message 3 of 8 in “Long names for `git log -S` and `git log -G`”
  1. Illia BobyrNov 18, 2024
  2. Junio C HamanoNov 19, 2024
  3. Jeff KingNov 19, 2024
  4. Illia BobyrNov 21, 2024
  5. Junio C HamanoNov 22, 2024
  6. 0/1 Long names for `git log -S` and `git log -G`Illia Bobyr, Feb 5, 2025
  7. 1/1 diff: --patch{-modifies,grep} arg names for -S and -GIllia Bobyr, Feb 5, 2025
  8. Johannes SixtFeb 5, 2025

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.