From: Junio C Hamano Date: Fri, 25 Jan 2013 20:34:55 +0000 (-0800) Subject: Merge branch 'nd/retire-fnmatch' X-Git-Tag: v1.8.2-rc0~85 X-Git-Url: https://repo.or.cz/w/git.git/commitdiff_plain/9ecd9f5dc300235593e4d3e4ecff4448f2500bad Merge branch 'nd/retire-fnmatch' Replace our use of fnmatch(3) with a more feature-rich wildmatch. A handful patches at the bottom have been moved to nd/wildmatch to graduate as part of that branch, before this series solidifies. We may want to mark USE_WILDMATCH as an experimental curiosity a bit more clearly (i.e. should not be enabled in production environment, because it will make the behaviour between builds unpredictable). * nd/retire-fnmatch: Makefile: add USE_WILDMATCH to use wildmatch as fnmatch wildmatch: advance faster in + patterns wildmatch: make a special case for "*/" with FNM_PATHNAME test-wildmatch: add "perf" command to compare wildmatch and fnmatch wildmatch: support "no FNM_PATHNAME" mode wildmatch: make dowild() take arbitrary flags wildmatch: rename constants and update prototype --- 9ecd9f5dc300235593e4d3e4ecff4448f2500bad diff --cc dir.c index cf1e6b0082,6ef03961f3..57394e452e --- a/dir.c +++ b/dir.c @@@ -685,20 -595,16 +685,21 @@@ int match_pathname(const char *pathname } return wildmatch(pattern, name, - ignore_case ? FNM_CASEFOLD : 0) == 0; + WM_PATHNAME | (ignore_case ? WM_CASEFOLD : 0), + NULL) == 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;