diff options
| author | Patrick Steinhardt <ps@pks.im> | 2019-06-13 15:27:22 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2019-06-15 09:34:21 +0200 |
| commit | de70bb46ae4ea91c26f6afdc210f37b8980b7a76 (patch) | |
| tree | 6f650a4b546924ef65dd9c8f9ef6302658312930 /src/status.c | |
| parent | 451df7930db432e7b251bbd0fe2862fe96424ae9 (diff) | |
| download | libgit2-de70bb46ae4ea91c26f6afdc210f37b8980b7a76.tar.gz | |
global: convert trivial `fnmatch` users to use `wildcard`
Upstream git.git has converted its codebase to use wildcard in
favor of fnmatch in commit 70a8fc999d (stop using fnmatch (either
native or compat), 2014-02-15). To keep our own regex-matching in
line with what git does, convert all trivial instances of
`fnmatch` usage to use `wildcard`, instead. Trivial usage is
defined to be use of `fnmatch` with either no flags or flags that
have a 1:1 equivalent in wildmatch (PATHNAME, IGNORECASE).
Diffstat (limited to 'src/status.c')
| -rw-r--r-- | src/status.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/status.c b/src/status.c index 84c4b66c6..a01736dee 100644 --- a/src/status.c +++ b/src/status.c @@ -16,7 +16,7 @@ #include "repository.h" #include "ignore.h" #include "index.h" -#include "fnmatch.h" +#include "wildmatch.h" #include "git2/diff.h" #include "diff.h" @@ -457,7 +457,7 @@ struct status_file_info { char *expected; unsigned int count; unsigned int status; - int fnm_flags; + int wildmatch_flags; int ambiguous; }; @@ -469,11 +469,11 @@ static int get_one_status(const char *path, unsigned int status, void *data) sfi->count++; sfi->status = status; - strcomp = (sfi->fnm_flags & FNM_CASEFOLD) ? git__strcasecmp : git__strcmp; + strcomp = (sfi->wildmatch_flags & WM_CASEFOLD) ? git__strcasecmp : git__strcmp; if (sfi->count > 1 || (strcomp(sfi->expected, path) != 0 && - p_fnmatch(sfi->expected, path, sfi->fnm_flags) != 0)) + wildmatch(sfi->expected, path, sfi->wildmatch_flags) != 0)) { sfi->ambiguous = true; return GIT_EAMBIGUOUS; /* git_error_set will be done by caller */ @@ -500,7 +500,7 @@ int git_status_file( if ((sfi.expected = git__strdup(path)) == NULL) return -1; if (index->ignore_case) - sfi.fnm_flags = FNM_CASEFOLD; + sfi.wildmatch_flags = WM_CASEFOLD; opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR; opts.flags = GIT_STATUS_OPT_INCLUDE_IGNORED | |
