Re: [RFC] Making ce_path_match() more useful by accepting globs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 26, 2007, 00:30 UTC
- Message-ID
- <7vlk8lj1b7.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20071126001114.GA10286@steel.home>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 9 quoted lines
> Junio C Hamano, Sun, Nov 25, 2007 19:03:12 +0100: >> Currently ce_path_match() only uses "the leading directory" match, and >> does not understand file globs. These do not work: >> >> git diff-files 't/*.sh' >> git diff-index HEAD 'xdiff/*.c' >> git update-index -g 'Documentation/howto/*.txt' > > How should my scripts handle files with "*" in names?
We DO NOT CARE.
Why?
How would you handle such files from the command line session without git? "ls such-*-a-file" will also show such-silly-a-file as well.
IOW, the user is shooting in the foot --- and at that point I am not all that interested in helping him.
Having said that, I would think that quoting the meta from fnmatch(3) like this:
git ls-files 'such-\*-a-file'
would work fine, just like
ls such-\*-a-file
would.
If "ls such-*-a-file" reports only one file,
git ls-files 'such-*-a-file'
would also report that file as well.
So in practice I do not see a problem.