From: Junio C Hamano Date: Thu, 10 Jan 2013 21:47:25 +0000 (-0800) Subject: Merge branch 'as/dir-c-cleanup' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d912b0e44f82dc430a4aac8566a8217b60629638;p=git.git Merge branch 'as/dir-c-cleanup' 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 --- d912b0e44f82dc430a4aac8566a8217b60629638 diff --cc dir.c index 378075504,41f141c8d..e883a9148 --- a/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;