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/              |  38 ++++++
 t/ |  19 +++
 t/               | 184 ++++++++++++++++++++++++++++
 test-wildmatch.c                   |  14 +++
 wildmatch.c                        | 245 +++++++++++++++++++++++++++++++++++++
 wildmatch.h                        |   3 +
 11 files changed, 532 insertions(+), 2 deletions(-)
 create mode 100755 t/
 create mode 100644 test-wildmatch.c
 create mode 100644 wildmatch.c
 create mode 100644 wildmatch.h


To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to