# git-grep: small suggestion, -w flag

5 messages from 2009-02-22 to 2009-02-22. Participants: Ingo Molnar, René Scharfe, Miklos Vajna.
Thread: https://gitlist.dev/t/17946

## Ingo Molnar, 2009-02-22 10:34

Subject: git-grep: small suggestion, -w flag
Message-ID: <20090222103448.GA32119@elte.hu>
URL: https://gitlist.dev/e/20090222103448.GA32119%40elte.hu

```
Here's a stupid little git-grep suggestion.

I recently transitioned from the use of egrep to git-grep, and i 
like it very much (it nicely excludes build related files, 
etc.), but there's one small detail: the lack of the -w flag.

It's equivalent to this pattern:

   git grep '\<tick_length\>'

And it's the most common grep flag i (and i suspect many others) 
use, in addition to the (already supported) -l flag.

When grepping for symbols in a large repository (such as the 
Linux kernel) -w is very common and very useful - there's many 
similar symbols, variants of each other. I use it when seeing a 
symbol in an oops, etc.

While i realize that git-grep does not want to be a full grep 
replacement, there's a real usability difference between having 
to type:

   git grep '\<schedule\>'
   git grep -w schedule

(especially since backslash is a seldom used key during a normal 
workflow, so accessing it is often a small mental hickup.)

	Ingo

```

## René Scharfe, 2009-02-22 11:15

Subject: Re: git-grep: small suggestion, -w flag
Message-ID: <49A133C9.2030601@lsrfire.ath.cx>
URL: https://gitlist.dev/e/49A133C9.2030601%40lsrfire.ath.cx
In-Reply-To: <20090222103448.GA32119@elte.hu>

```
Ingo Molnar schrieb:
> Here's a stupid little git-grep suggestion.
> 
> I recently transitioned from the use of egrep to git-grep, and i 
> like it very much (it nicely excludes build related files, 
> etc.), but there's one small detail: the lack of the -w flag.

git grep knows this flag since version 1.4.1.  Does it do something
different from egrep's?

René

```

## Ingo Molnar, 2009-02-22 16:14

Subject: Re: git-grep: small suggestion, -w flag
Message-ID: <20090222161410.GA24886@elte.hu>
URL: https://gitlist.dev/e/20090222161410.GA24886%40elte.hu
In-Reply-To: <49A133C9.2030601@lsrfire.ath.cx>

```

* René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:

> Ingo Molnar schrieb:
> > Here's a stupid little git-grep suggestion.
> > 
> > I recently transitioned from the use of egrep to git-grep, and i 
> > like it very much (it nicely excludes build related files, 
> > etc.), but there's one small detail: the lack of the -w flag.
> 
> git grep knows this flag since version 1.4.1.  Does it do 
> something different from egrep's?

ah:

 earth4:~/tip> git grep -lw schedule
 usage: git grep <option>* [-e] <pattern> <rev>* [[--] <path>...]


should have been 'git grep -l -w schedule'.

	Ingo

```

## Miklos Vajna, 2009-02-22 17:20

Subject: Re: git-grep: small suggestion, -w flag
Message-ID: <20090222172055.GW4371@genesis.frugalware.org>
URL: https://gitlist.dev/e/20090222172055.GW4371%40genesis.frugalware.org
In-Reply-To: <20090222161410.GA24886@elte.hu>

```
On Sun, Feb 22, 2009 at 05:14:10PM +0100, Ingo Molnar <mingo@elte.hu> wrote:
>  earth4:~/tip> git grep -lw schedule
>  usage: git grep <option>* [-e] <pattern> <rev>* [[--] <path>...]
> 
> 
> should have been 'git grep -l -w schedule'.

Yeah, that's because git-grep does not use parseopt yet.

I'm willing to work on it once mv/parseopt-ls-files is settled down.

```

## Ingo Molnar, 2009-02-22 17:23

Subject: Re: git-grep: small suggestion, -w flag
Message-ID: <20090222172300.GF6570@elte.hu>
URL: https://gitlist.dev/e/20090222172300.GF6570%40elte.hu
In-Reply-To: <20090222172055.GW4371@genesis.frugalware.org>

```

* Miklos Vajna <vmiklos@frugalware.org> wrote:

> On Sun, Feb 22, 2009 at 05:14:10PM +0100, Ingo Molnar <mingo@elte.hu> wrote:
> >  earth4:~/tip> git grep -lw schedule
> >  usage: git grep <option>* [-e] <pattern> <rev>* [[--] <path>...]
> > 
> > 
> > should have been 'git grep -l -w schedule'.
> 
> Yeah, that's because git-grep does not use parseopt yet.
> 
> I'm willing to work on it once mv/parseopt-ls-files is settled 
> down.

As long as it's planned eventually i'm a happy camper! No rush.

	Ingo

```
