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

[PATCH 0/8] wildmatch take 3

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 9, 2012, 03:08 UTC
Message-ID
<1349752147-13314-1-git-send-email-pclouds@gmail.com>

Still experimental but the semantics is getting better, I think. Please point out what you think still does not make sense. Quote from the last patch:

  Two consecutive asterisks ("`**`") in patterns matched against
  full pathname may have special meaning:
  
   - A leading "`**`" followed by a slash means match in all
     directories. For example, "`**/foo`" matches file or directory
     "`foo`" anywhere, the same as pattern "`foo`". "**/foo/bar"
     matches file or directory "`bar`" anywhere that is directly
     under directory "`foo`".
  
   - A trailing "/**" matches everything inside. For example,
     "abc/**" is equivalent to "`/abc/`".
  
   - A slash followed by two consecutive asterisks then a slash
     matches zero or more directories. For example, "`a/**/b`"
     matches "`a/b`", "`a/x/b`", "`a/x/y/b`" and so on.
  
   - Consecutive asterisks otherwise are treated like normal
     asterisk wildcards.

"abc/**" and "abc/*" are different in attr (the former matches all files, the latter only files directly under abc) while they are the same for ignore. I don't like these subtleties but I don't think we have a choice unless we rework attr matching machinery.

Tests t3070.100 and .101 fail on some machine and not on other due to (I guess) fnmatch behavior changes. Maybe we should fallback on compat/fnmatch in such cases for consistent behavior.

There are problems with asciidoc and "`**/`" but that's not something we need to care now.

On top of master (and a small conflict with nd/attr-match-optim-more)
Nguyễn Thái Ngọc Duy (8):
  Import wildmatch from rsync
  wildmatch: remove unnecessary functions
  Integrate wildmatch to git
  wildmatch: remove static variable force_lower_case
  wildmatch: fix case-insensitive matching
  wildmatch: adjust "**" behavior
  wildmatch: make /**/ match zero or more directories
  Support "**" wildcard in .gitignore and .gitattributes
 .gitignore                         |   1 +
 Documentation/gitignore.txt        |  19 +++
 Makefile                           |   3 +
 attr.c                             |   4 +-
 dir.c                              |   4 +-
 t/t0003-attributes.sh              |  38 ++++++
 t/t3001-ls-files-others-exclude.sh |  19 +++
 t/t3070-wildmatch.sh               | 184 ++++++++++++++++++++++++++++
 test-wildmatch.c                   |  14 +++
 wildmatch.c                        | 245 +++++++++++++++++++++++++++++++++++++
 wildmatch.h                        |   3 +
 11 files changed, 532 insertions(+), 2 deletions(-)
 create mode 100755 t/t3070-wildmatch.sh
 create mode 100644 test-wildmatch.c
 create mode 100644 wildmatch.c
 create mode 100644 wildmatch.h
-- 
1.8.0.rc0.29.g1fdd78f
Next: Nguyễn Thái Ngọc Duy
Message 1 of 15 in “wildmatch take 3”
  1. 0/8 wildmatch take 3Nguyễn Thái Ngọc Duy, Oct 9, 2012
  2. 1/8 Import wildmatch from rsyncNguyễn Thái Ngọc Duy, Oct 9, 2012
  3. 2/8 wildmatch: remove unnecessary functionsNguyễn Thái Ngọc Duy, Oct 9, 2012
  4. 3/8 Integrate wildmatch to gitNguyễn Thái Ngọc Duy, Oct 9, 2012
  5. 4/8 wildmatch: remove static variable force_lower_caseNguyễn Thái Ngọc Duy, Oct 9, 2012
  6. Junio C HamanoOct 9, 2012
  7. Nguyen Thai Ngoc DuyOct 10, 2012
  8. Junio C HamanoOct 10, 2012
  9. Nguyen Thai Ngoc DuyOct 10, 2012
  10. 5/8 wildmatch: fix case-insensitive matchingNguyễn Thái Ngọc Duy, Oct 9, 2012
  11. 6/8 wildmatch: adjust "**" behaviorNguyễn Thái Ngọc Duy, Oct 9, 2012
  12. 7/8 wildmatch: make /**/ match zero or more directoriesNguyễn Thái Ngọc Duy, Oct 9, 2012
  13. 8/8 Support "**" wildcard in .gitignore and .gitattributesNguyễn Thái Ngọc Duy, Oct 9, 2012
  14. Michael HaggertyOct 9, 2012
  15. Nguyen Thai Ngoc DuyOct 10, 2012

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.