Re: [PATCHv3 1/2] Documentation: clarify fnmatch behavior in gitignore
- From
Eric Blake <eblake@redhat.com>
- Date
- Apr 5, 2011, 22:43 UTC
- Message-ID
- <4D9B9B15.8040600@redhat.com>
- In-Reply-To
- <7vfwpwl43h.fsf@alter.siamese.dyndns.org>
On 04/05/2011 04:34 PM, Junio C Hamano wrote:
Show 9 quoted lines
>> - Otherwise, git treats the pattern as a shell glob suitable
>> - for consumption by fnmatch(3) with the FNM_PATHNAME flag:
>> - wildcards in the pattern will not match a / in the pathname.
>> - For example, "Documentation/{asterisk}.html" matches
>> + for consumption by fnmatch(3) with the FNM_PATHNAME but not
>> + FNM_PERIOD flags: wildcards in the pattern will match leading
>> + . but not / in pathnames. For example,
>
> Does this format correctly with asciidoc?No idea - I'm not an asciidoc whiz. How would I tell (or can someone else offer some advice)?
Show 8 quoted lines
> > Even if it does not get confused as a bullet or something, I think you > would want to quote it (and the slash), perhaps like > > `.` (dot) and `/` (slash) > > In any case, I tend to think that we would want to add FNM_PERIOD to > tighten the match in the longer term, perhaps at the 1.8.0 boundary.
POSIX requires that "find . -name '*'" not use FNM_PERIOD, and I actually like the consistency with find(1). In other words, I would complain (then go with group consensus, if my complaint is in the minority) that it is a step backwards to tighten the match, where the short:
dir/*
would have to become the much longer
dir/* dir/.[!.] dir/.??*
to properly exclude all except '.' and '..', or
dir/* dir/.*
if '.' and '..' are already special to the pattern matching.
-- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org