<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-grep.sh, branch v0.99.8a</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v0.99.8a</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v0.99.8a'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2005-09-24T22:09:48Z</updated>
<entry>
<title>git-grep: fix 'git grep -e $pattern' handling</title>
<updated>2005-09-24T22:09:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-09-24T22:09:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9fc748f84857a237f47deb91f87499e82865c83'/>
<id>urn:sha1:c9fc748f84857a237f47deb91f87499e82865c83</id>
<content type='text'>
People typically say 'grep -e $pattern' because $pattern has a leading
dash which would be mistaken as a grep flag.  Make sure we pass -e in
front of $pattern when we invoke grep.

Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>Improve "git grep" flags handling</title>
<updated>2005-09-13T02:15:02Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-09-12T23:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d9d831a51dc7847ad40fac77f9a072aa2d1c0bd'/>
<id>urn:sha1:5d9d831a51dc7847ad40fac77f9a072aa2d1c0bd</id>
<content type='text'>
This allows any arbitrary flags to "grep", and knows about the few
special grep flags that take an argument too.

It also allows some flags for git-ls-files, although their usefulness
is questionable.

With this, something line

	git grep -w -1 pattern

works, without the script enumerating every possible flag.

[jc: this is the version Linus sent out after I showed him a
 barf-o-meter test version that avoids shell arrays.  He must
 have typed this version blindly, since he said:

    I'm not barfing, but that's probably because my brain just shut
    down and is desperately trying to gouge my eyes out with a spoon.

 I slightly fixed it to catch the remaining arguments meant to be
 given git-ls-files.]

Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>Allow finding things that begin with a dash in 'git grep'</title>
<updated>2005-09-12T20:24:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>junkio@cox.net</email>
</author>
<published>2005-09-12T20:24:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=540bf654d007b3289adec37e3008c588ba677e25'/>
<id>urn:sha1:540bf654d007b3289adec37e3008c588ba677e25</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
<entry>
<title>[PATCH] Add "git grep" helper</title>
<updated>2005-09-12T20:20:03Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@osdl.org</email>
</author>
<published>2005-09-12T19:06:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f22cc3fcbfe7755154a3a151215abd39162e2e85'/>
<id>urn:sha1:f22cc3fcbfe7755154a3a151215abd39162e2e85</id>
<content type='text'>
Very convenient shorthand for

	git-ls-files [file-patterns] | xargs grep &lt;pattern&gt;

which I tend to do all the time.

Yes, it's trivial, but it's really nice. I can do

	git grep '\&lt;some_variable\&gt;' arch/i386 include/asm-i386

and it does exactly what you'd think it does. And since it just uses the
normal git-ls-files file patterns, you can do things like

	git grep something 'include/*.h'

and it will search all header files under the include/ subdirectory.

Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Signed-off-by: Junio C Hamano &lt;junkio@cox.net&gt;
</content>
</entry>
</feed>
