From: Jay Soffian Date: Wed, 15 Sep 2010 23:19:28 GMT Subject: Re: ls-files --exclude broken? Message-ID: In-Reply-To: <7v62y661pl.fsf@alter.siamese.dyndns.org> On Wed, Sep 15, 2010 at 7:12 PM, Junio C Hamano wrote: >> Am I missing something really obvious here? >> >> kore:~/Repos/git (master)$ git ls-files | wc -l >>     2009 > > You asked it to show the cached paths (default).  Your project currently > tracks 2009 paths in the index. Correct. >> kore:~/Repos/git (master)$ git ls-files -x \* | wc -l >>     2009 > > You told that '*' is the exclude pattern for carrying out some operation, > but you didn't tell what operation you want.  You are shown the cached > paths (default). I want cached paths, minus the exclude pattern. Using -c -x \* gives the same result. There is no indication in the man page that -x doesn't apply to -c. >> kore:~/Repos/git (master)$ git ls-files -i -x \* | wc -l >>     2009 > > You told that '*' is the exclude pattern, you want only paths that match > the exclude pattern, and chose to show files in the index (which again is > the default) by not saying -o. > > I've never found -i useful myself (actually I don't find many options the > command has very useful anymore), but the above is how I read the ls-files > manual page. I don't care about -i myself, and maybe I should have been clearer. AFAICT, [-c] -x is broken: $ git ls-files -c -x \* |wc -l 2009 -c, --cached Show cached files in the output (default) -x , --exclude= Skips files matching pattern. Note that pattern is a shell wildcard pattern. Oh, geez, here it is lower down in the man page: git ls-files can use a list of "exclude patterns" when traversing the directory tree and finding files to show when the flags --others or --ignored are specified. gitignore(5) specifies the format of exclude patterns. Bah, what use is that? Minimally ls-files shouldn't accept -x unless given either --ignored or --others if that's all it applies to. I guess this is my itch to scratch. j.