Hello,

I recently discovered the boolean logic features of git grep: --and, --or, 
--not, ( <-- open paren, ) <-- close paren.  I was trying to filter a bunch 
of files using grep where I needed to do logical-and using multiple 
patterns.  Unfortunately, I'm struggling a bit with git grep, so I write 
here for support.

I am running Debian Linux x86_64 bleeding edge.

$ git --version
git version 2.34.1

My goal is to search files not managed by git in arbitrary pathspecs -- 
multiple relative or absolute paths.  Unfortunately, the --no-index option 
doesn't do what I expect.

Here is a simple example to demonstrate:
Imagine we have a file called /path/to/data.txt that has multiple lines.  
Our goal is to match this file if we can find both (logical-and) abc and 
def.

Unfortunately, this command does not work:
$ git grep --all-match --no-index --files-with-matches -e abc -e def 
/path/to/data.txt

Exit status: 134
BUG: environment.c:202: git environment hasn't been setup
Aborted

I can see the code 
here: https://github.com/git/git/blob/master/environment.c#L203

I tried many varieties of --all-match, --and, relative and absolute paths.  
All give the same "BUG" failure.

Can anyone give a hint how to make this work?

Thanks,
Kevin Arpe
Hongkong

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/551efeab-4c27-4e16-899d-48fcf46c9d56n%40googlegroups.com.

Reply via email to