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

Re: RFH - git-log variant that _does_ search through diffs

From
Jeff King <peff@peff.net>
Date
Jun 30, 2009, 04:03 UTC
Message-ID
<20090630040337.GA23741@sigio.peff.net>
In-Reply-To
<279b37b20906291708g67da3a75p316ea4893f02666a@mail.gmail.com>
On Mon, Jun 29, 2009 at 05:08:47PM -0700, Eric Raible wrote:
> [Surely this has been address before,  but I wasn't able to find it...]
There is some discussion here:
  http://article.gmane.org/gmane.comp.version-control.git/112077
Show 8 quoted lines
> The documentation for git-log -S includes:
> 
> "Look for differences that introduce or remove an instance of <string>.
>  Note that this is different than the string simply appearing in diff output"
> 
> But I want to do that "different" thing (IOW I want search the diff output).
> 
> So must I loop through git-rev-list, grepping git-diff output on each commit?

Currently, yes. There is no way to do it internally. A patch to implement it would probably be accepted, though (see the thread I mentioned above for more details).

You can at least combine rev-list and diff into one command, and grep like this (for 'foo'):

  git log -z -p | perl -0ne 'print if /^[-+].*foo/m' | tr '\0' '\n'
-Peff
Previous: Eric RaibleNext: Junio C Hamano
Message 2 of 12 in “RFH - git-log variant that _does_ search through diffs”
  1. Eric RaibleJun 30, 2009
  2. Jeff KingJun 30, 2009
  3. Junio C HamanoJun 30, 2009
  4. Eric RaibleJun 30, 2009
  5. Eric RaibleJun 30, 2009
  6. Jeff KingJun 30, 2009
  7. Eric RaibleJun 30, 2009
  8. Eric RaibleJun 30, 2009
  9. Jeff KingJul 1, 2009
  10. 1/2 log-tree: fix confusing commentJeff King, Jul 1, 2009
  11. 2/2 fix missing NUL termination with pretty=tformatJeff King, Jul 1, 2009
  12. Junio C HamanoJul 1, 2009

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.