Re: RFH - git-log variant that _does_ search through diffs
- From
- Eric Raible <raible@gmail.com>
- Date
- Jun 30, 2009, 18:05 UTC
- Message-ID
- <279b37b20906301105tf92f471g6146a083ba2e2882@mail.gmail.com>
- In-Reply-To
- <20090630040337.GA23741@sigio.peff.net>
On Mon, Jun 29, 2009 at 9:03 PM, Jeff King<peff@peff.net> wrote:
Show 6 quoted lines
> 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
Thank you, that will do very nicely as a starting point.
What I _really_ want is the subset of all commits containing foo who's oneline commit message doesn't match a given regexp.
So I'm used something like this to extract the commits of interest:
git log -z -p | perl -0ne 'print if /^[-+].*foo/m' | tr '\0' '\n' | grep "^commit [0-9a-f]" | awk '{print $2}' | xargs -n1 git log --pretty=oneline -1 | grep -v dont_want
In this specific case of wanting to ignore particular commits a loop over git-rev-list might yield a better solution. But the 'git-log | perl | tr' snippet is a nice idiom for day-to-day use.