Subject: Re: [PATCHv3 1/2] Documentation: clarify fnmatch behavior in gitignore

From: Eric Blake <[email-masked]>
Date: Tue, 05 Apr 2011 16:43:33 -0600

On 04/05/2011 04:34 PM, Junio C Hamano wrote:
>>   - 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)?

> 
> 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   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org