From: Michael J Gruber Date: Fri, 11 Feb 2011 15:04:43 GMT Subject: Re: grep --no-index and pathspec Message-ID: <4D55500B.1070603@drmicha.warpmail.net> In-Reply-To: <20110211095938.360726y1zinab9gk@webmail.df.eu> Lars Noschinski venit, vidit, dixit 11.02.2011 09:59: > Hi everyone, > > I encountered some strange behaviour with grep when using both the > --no-index option and a pathspec. Glob patterns seem to be ignored: > > ---------- > $ git grep -l --no-index . -- '*.bib' > paper.bib > paper.tex > ex1.tex > ---------- > > But on the other hands, leading path matches work: > ---------- > $ git grep -l --no-index . -- 'paper' > paper.bib > paper.tex > ---------- > > Without the --no-index option, everything works fine: > ---------- > $ git grep -l --no-index . -- '*.bib' > paper.bib > ---------- > > This is with git version 1.7.4, but I encountered it also with the > 1.7.2.3 Debian package. "grep --no-index" and "grep" have different codepaths for looking up the files/blobs. If I read that correctly then "grep --no-index -- pathspec" only does a literal match at the left boundary, whereas for the normal mode glob patterns are allowed. CC'ing Junio who created "--no-index". Michael