git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Drew Northup
Message 5 of 6 in “[PATCHv3 1/2] Documentation: clarify fnmatch behavior in gitignore”
  1. Eric BlakeApr 5, 2011
  2. 2/2 Documentation: enhance gitignore whitelist exampleEric Blake, Apr 5, 2011
  3. Junio C HamanoApr 5, 2011
  4. Junio C HamanoApr 5, 2011
  5. Eric BlakeApr 5, 2011
  6. Drew NorthupApr 6, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.