Thread (9 messages) flat view 9 messages, 2 authors, 2016-06-15

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

From: Eric Raible <hidden>
Date: 2016-06-15 22:47:00

On Tue, Jun 30, 2009 at 2:22 PM, Eric Raible[off-list ref] wrote:
On Tue, Jun 30, 2009 at 12:31 PM, Jeff King[off-list ref] wrote:
quoted
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' | ...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help