On Fri, Oct 03, 2014 at 10:38:18AM +0200, Mercier Ivan wrote:
> Hi,
> to work the pattern should be on the same line...
> is it normal?how can I can grep in all lines?
> I thought --all-match does it!?
> My test:
> mkdir test
> cd test
> git init
> echo -e "titi\ntoto" > file1
> git add -A
> git grep -l --all-match -e toto --and --not -e titi gives me file1
> echo -e "titi toto" > file1
> git grep -l --all-match -e toto --and --not -e titi returns me nothing,
> which is correct

Ah, then I understand what you mean.

The tool `grep` print lines matching a pattern.  It's entirely
expected that `git grep` also print lines matching a pattern
(otherwise it would be badly named).

There are tools that can handle patterns that span line, but `grep`
can't[1].  That's not exactly what you want though, you want a `grep`
that considers the pattern across the whole file.  There are tricks to
do that[2].



Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe               http://therning.org/magnus

I invented the term Object-Oriented, and I can tell you I did not have
C++ in mind.
     -- Alan Kay

Attachment: pgpLGeBLGkOA1.pgp
Description: PGP signature

Reply via email to