Merge branch 'nd/wildmatch'
authorJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:15 +0000 (13:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:20 +0000 (13:47 -0800)
Allows pathname patterns in .gitignore and .gitattributes files
with double-asterisks "foo/**/bar" to match any number of directory
hierarchies.

* nd/wildmatch:
  wildmatch: replace variable 'special' with better named ones
  compat/fnmatch: respect NO_FNMATCH* even on glibc
  wildmatch: fix "**" special case
  t3070: Disable some failing fnmatch tests
  test-wildmatch: avoid Windows path mangling
  Support "**" wildcard in .gitignore and .gitattributes
  wildmatch: make /**/ match zero or more directories
  wildmatch: adjust "**" behavior
  wildmatch: fix case-insensitive matching
  wildmatch: remove static variable force_lower_case
  wildmatch: make wildmatch's return value compatible with fnmatch
  t3070: disable unreliable fnmatch tests
  Integrate wildmatch to git
  wildmatch: follow Git's coding convention
  wildmatch: remove unnecessary functions
  Import wildmatch from rsync
  ctype: support iscntrl, ispunct, isxdigit and isprint
  ctype: make sane_ctype[] const array

Conflicts:
Makefile

1  2 
.gitignore
Documentation/gitignore.txt
Makefile
compat/fnmatch/fnmatch.c
dir.c
git-compat-util.h
t/t0003-attributes.sh

diff --cc .gitignore
index 8e8dc275db9bcc1155e42daea5a6589b4802bc9c,1153a4bb3acdefd15016bee55fd47b35d91f0a2b..aa258a6bcfe105cdb872c6d77cd9bd19c84e8dc5
  /test-run-command
  /test-sha1
  /test-sigchain
 +/test-string-list
  /test-subprocess
  /test-svn-fe
+ /test-wildmatch
  /common-cmds.h
  *.tar.gz
  *.dsc
Simple merge
diff --cc Makefile
index cd0664accb3c862354042de3b719b2ab925cd053,bc868d15485e0d65bcf44982df6323bc42e75a48..f37fb240cc11a7dc22b423cb2e09571035e237c9
+++ b/Makefile
@@@ -529,9 -501,9 +529,10 @@@ TEST_PROGRAMS_NEED_X += test-run-comman
  TEST_PROGRAMS_NEED_X += test-scrap-cache-tree
  TEST_PROGRAMS_NEED_X += test-sha1
  TEST_PROGRAMS_NEED_X += test-sigchain
 +TEST_PROGRAMS_NEED_X += test-string-list
  TEST_PROGRAMS_NEED_X += test-subprocess
  TEST_PROGRAMS_NEED_X += test-svn-fe
+ TEST_PROGRAMS_NEED_X += test-wildmatch
  
  TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))
  
@@@ -703,8 -675,7 +704,9 @@@ LIB_H += url.
  LIB_H += userdiff.h
  LIB_H += utf8.h
  LIB_H += varint.h
 +LIB_H += walker.h
+ LIB_H += wildmatch.h
 +LIB_H += wt-status.h
  LIB_H += xdiff-interface.h
  LIB_H += xdiff/xdiff.h
  
@@@ -836,8 -804,8 +838,9 @@@ LIB_OBJS += usage.
  LIB_OBJS += userdiff.o
  LIB_OBJS += utf8.o
  LIB_OBJS += varint.o
 +LIB_OBJS += version.o
  LIB_OBJS += walker.o
+ LIB_OBJS += wildmatch.o
  LIB_OBJS += wrapper.o
  LIB_OBJS += write_or_die.o
  LIB_OBJS += ws.o
Simple merge
diff --cc dir.c
Simple merge
index 2cecf56eb367ccd866250b7634c738187d6e2261,02f48f653bf833dc9b4f8d6b52651c094b5ccc67..e5a4b7450bfa7a700ce1c76f597266a9724a19f5
@@@ -528,7 -470,11 +528,11 @@@ extern const char tolower_trans_tbl[256
  #undef isupper
  #undef tolower
  #undef toupper
- extern unsigned char sane_ctype[256];
+ #undef iscntrl
+ #undef ispunct
+ #undef isxdigit
 -#undef isprint
++
+ extern const unsigned char sane_ctype[256];
  #define GIT_SPACE 0x01
  #define GIT_DIGIT 0x02
  #define GIT_ALPHA 0x04
  #define isupper(x) sane_iscase(x, 0)
  #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
  #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
 -#define isprint(x) (sane_istest(x, GIT_ALPHA | GIT_DIGIT | GIT_SPACE | \
 -              GIT_PUNCT | GIT_REGEX_SPECIAL | GIT_GLOB_SPECIAL | \
 -              GIT_PATHSPEC_MAGIC))
+ #define iscntrl(x) (sane_istest(x,GIT_CNTRL))
+ #define ispunct(x) sane_istest(x, GIT_PUNCT | GIT_REGEX_SPECIAL | \
+               GIT_GLOB_SPECIAL | GIT_PATHSPEC_MAGIC)
+ #define isxdigit(x) (hexval_table[x] != -1)
  #define tolower(x) sane_case((unsigned char)(x), 0x20)
  #define toupper(x) sane_case((unsigned char)(x), 0)
  #define is_pathspec_magic(x) sane_istest(x,GIT_PATHSPEC_MAGIC)
Simple merge