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

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

From
EREric Raible <raible@gmail.com>
Date
Jun 30, 2009, 21:34 UTC
Message-ID
<279b37b20906301434r46e6973ftf5e5f68778f9fa1d@mail.gmail.com>
In-Reply-To
<279b37b20906301422w2b895afai5edf42fcbfcc7d5a@mail.gmail.com>
On Tue, Jun 30, 2009 at 2:22 PM, Eric Raible<raible@gmail.com> wrote:
Show 14 quoted lines
> On Tue, Jun 30, 2009 at 12:31 PM, Jeff King<peff@peff.net> wrote:
>>
>> I think you can do this a little more simply and efficiently as:
>>
>>  git log -z -p --format='GREP: %s' |
>>    perl -0ne 'print if /^[-+].*foo/m && !/^GREP:.*dont_want/' |
>>    tr '\0' '\n'
>>
>> (though note that --format is new as of 1.6.3, I think; before that you
>> have to use "--pretty=format:"). Many fewer process invocations, and
>> less typing, though still easy to mess up.
>
> I agree that --format leads to a much prettier solution.
> Unfortunately --format seems to turn off -z (at least in msysgit):

Sorry to self-reply, but one obvious workaround is to encode the NULL explicitly:

git log -z -p --format='%x00GREP: %s' | ...
Previous: Eric RaibleNext: Jeff King
Message 8 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.