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

Re: git log -S or -G

From
JLJulia Lawall <julia.lawall@lip6.fr>
Date
Oct 7, 2018, 05:21 UTC
Message-ID
<alpine.DEB.2.21.1810070719200.2347@hadrien>
In-Reply-To
<xmqqd0smvay0.fsf@gitster-ct.c.googlers.com>
On Sun, 7 Oct 2018, Junio C Hamano wrote:
Show 25 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
> > On Sat, Oct 6, 2018 at 5:16 PM Julia Lawall <julia.lawall@lip6.fr> wrote:
> >> Git log -S or -G make it possible to find commits that have particular
> >> words in the changed lines.  Sometimes it would be helpful to search for
> >> words in the removed lines or in the added lines specifically.  From the
> >> implementation, I had the impression that this would be easy to implement.
> >> The main question would be how to allow the user to specify what is
> >> wanted.
> >
> > As far as I know this isn't possible. The --diff-filter option is
> > similar in spirit, but e.g. adding "foo" and then removing it from an
> > existing file will both be covered under --diff-filter=M, so that
> > isn't what you're looking for.
>
> I agree with Julia that UI to the feature is harder than the
> machinery to implement the feature to add "I am interested in seeing
> a patch that contains a hunk that adds 'foo' but am not interested
> in removal" (or vice versa) for -G.  You tweak
> diffcore-pickaxe.c::diffgrep_consume() and you'are done.
>
> Doing the same for -S is much harder at the machinery level, as it
> performs its thing without internally running "diff" twice, but just
> counts the number of occurrences of 'foo'---that is sufficient for
> its intended use, and more efficient.

There is still the question of whether the number of occurrences of foo decreases or increases.

julia
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 11 in “git log -S or -G”
  1. Julia LawallOct 6, 2018
  2. Ævar Arnfjörð BjarmasonOct 6, 2018
  3. Junio C HamanoOct 7, 2018
  4. Julia LawallOct 7, 2018
  5. Junio C HamanoOct 8, 2018
  6. Jeff KingOct 9, 2018
  7. Jacob KellerOct 9, 2018
  8. Julia LawallOct 9, 2018
  9. Junio C HamanoOct 9, 2018
  10. Ævar Arnfjörð BjarmasonOct 9, 2018
  11. Julia LawallOct 9, 2018

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.