diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-25 12:34:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-25 12:34:55 -0800 |
commit | 9ecd9f5dc300235593e4d3e4ecff4448f2500bad (patch) | |
tree | 507832849bd8e8f3ec7bd5b0a55b915336a43df8 /git-compat-util.h | |
parent | bb9aa109fd3df92cde642d67ba8a331c555d11ae (diff) | |
parent | cebcab189aa7727af5027f0215e798bbe66f2815 (diff) | |
download | git-9ecd9f5dc300235593e4d3e4ecff4448f2500bad.tar.gz |
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 <asterisk> + <literal> 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
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index dab545e02e..cc2abeea0d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -112,7 +112,9 @@ #include <sys/time.h> #include <time.h> #include <signal.h> +#ifndef USE_WILDMATCH #include <fnmatch.h> +#endif #include <assert.h> #include <regex.h> #include <utime.h> @@ -280,6 +282,17 @@ extern char *gitbasename(char *); #include "compat/bswap.h" +#ifdef USE_WILDMATCH +#include "wildmatch.h" +#define FNM_PATHNAME WM_PATHNAME +#define FNM_CASEFOLD WM_CASEFOLD +#define FNM_NOMATCH WM_NOMATCH +static inline int fnmatch(const char *pattern, const char *string, int flags) +{ + return wildmatch(pattern, string, flags, NULL); +} +#endif + /* General helper functions */ extern void vreportf(const char *prefix, const char *err, va_list params); extern void vwritef(int fd, const char *prefix, const char *err, va_list params); |