Merge branch 'as/dir-c-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:25 +0000 (13:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jan 2013 21:47:25 +0000 (13:47 -0800)
Refactor and generally clean up the directory traversal API
implementation.

* as/dir-c-cleanup:
  dir.c: rename free_excludes() to clear_exclude_list()
  dir.c: refactor is_path_excluded()
  dir.c: refactor is_excluded()
  dir.c: refactor is_excluded_from_list()
  dir.c: rename excluded() to is_excluded()
  dir.c: rename excluded_from_list() to is_excluded_from_list()
  dir.c: rename path_excluded() to is_path_excluded()
  dir.c: rename cryptic 'which' variable to more consistent name
  Improve documentation and comments regarding directory traversal API
  api-directory-listing.txt: update to match code

1  2 
attr.c
builtin/add.c
builtin/ls-files.c
dir.c
dir.h
unpack-trees.c

diff --cc attr.c
Simple merge
diff --cc builtin/add.c
Simple merge
Simple merge
diff --cc dir.c
index 37807550475cf488b60187872f698cbc6171dcb1,41f141c8d6df61b4d4f2592f1dbde4f26cb43c93..e883a91483981ad9e2da4841063c1c8bad6a25fd
--- 1/dir.c
--- 2/dir.c
+++ b/dir.c
@@@ -625,16 -603,20 +635,21 @@@ int match_pathname(const char *pathname
                namelen -= prefix;
        }
  
 -      return fnmatch_icase(pattern, name, FNM_PATHNAME) == 0;
 +      return wildmatch(pattern, name,
 +                       ignore_case ? FNM_CASEFOLD : 0) == 0;
  }
  
- /* Scan the list and let the last match determine the fate.
-  * Return 1 for exclude, 0 for include and -1 for undecided.
+ /*
+  * Scan the given exclude list in reverse to see whether pathname
+  * should be ignored.  The first match (i.e. the last on the list), if
+  * any, determines the fate.  Returns the exclude_list element which
+  * matched, or NULL for undecided.
   */
- int excluded_from_list(const char *pathname,
-                      int pathlen, const char *basename, int *dtype,
-                      struct exclude_list *el)
+ static struct exclude *last_exclude_matching_from_list(const char *pathname,
+                                                      int pathlen,
+                                                      const char *basename,
+                                                      int *dtype,
+                                                      struct exclude_list *el)
  {
        int i;
  
diff --cc dir.h
Simple merge
diff --cc unpack-trees.c
Simple merge