diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2014-02-15 09:01:46 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-20 14:15:46 -0800 |
commit | eb07894fe036566acccb71420ab79ccb9c9e2d66 (patch) | |
tree | 74709f072ea129623d3771433080de01d5010026 | |
parent | 5f95c9f850b19b368c43ae399cc831b17a26a5ac (diff) | |
download | git-eb07894fe036566acccb71420ab79ccb9c9e2d66.tar.gz |
use wildmatch() directly without fnmatch() wrapper
Make it clear that we don't use fnmatch() anymore.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/apply.c | 2 | ||||
-rw-r--r-- | builtin/branch.c | 2 | ||||
-rw-r--r-- | builtin/describe.c | 2 | ||||
-rw-r--r-- | builtin/for-each-ref.c | 2 | ||||
-rw-r--r-- | builtin/ls-remote.c | 2 | ||||
-rw-r--r-- | builtin/name-rev.c | 2 | ||||
-rw-r--r-- | builtin/reflog.c | 2 | ||||
-rw-r--r-- | builtin/replace.c | 2 | ||||
-rw-r--r-- | builtin/show-branch.c | 2 | ||||
-rw-r--r-- | builtin/tag.c | 2 | ||||
-rw-r--r-- | diffcore-order.c | 2 | ||||
-rw-r--r-- | dir.c | 11 | ||||
-rw-r--r-- | refs.c | 2 | ||||
-rw-r--r-- | revision.c | 2 |
14 files changed, 20 insertions, 17 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index b0d0986226..66e2eed539 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4152,7 +4152,7 @@ static int use_patch(struct patch *p) /* See if it matches any of exclude/include rule */ for (i = 0; i < limit_by_name.nr; i++) { struct string_list_item *it = &limit_by_name.items[i]; - if (!fnmatch(it->string, pathname, 0)) + if (!wildmatch(it->string, pathname, 0, NULL)) return (it->util != NULL); } diff --git a/builtin/branch.c b/builtin/branch.c index b4d771673e..652b1d2d14 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -315,7 +315,7 @@ static int match_patterns(const char **pattern, const char *refname) if (!*pattern) return 1; /* no pattern always matches */ while (*pattern) { - if (!fnmatch(*pattern, refname, 0)) + if (!wildmatch(*pattern, refname, 0, NULL)) return 1; pattern++; } diff --git a/builtin/describe.c b/builtin/describe.c index 7db43dae1b..848acdf299 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -150,7 +150,7 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void return 0; /* Accept only tags that match the pattern, if given */ - if (pattern && (!is_tag || fnmatch(pattern, path + 10, 0))) + if (pattern && (!is_tag || wildmatch(pattern, path + 10, 0, NULL))) return 0; /* Is it annotated? */ diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 51798b48b5..3e1d5c3334 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -864,7 +864,7 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f refname[plen] == '/' || p[plen-1] == '/')) break; - if (!fnmatch(p, refname, FNM_PATHNAME)) + if (!wildmatch(p, refname, WM_PATHNAME, NULL)) break; } if (!*pattern) diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 39e5144b9e..3e9eefb091 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -22,7 +22,7 @@ static int tail_match(const char **pattern, const char *path) if (snprintf(pathbuf, sizeof(pathbuf), "/%s", path) > sizeof(pathbuf)) return error("insanely long ref %.*s...", 20, path); while ((p = *(pattern++)) != NULL) { - if (!fnmatch(p, pathbuf, 0)) + if (!wildmatch(p, pathbuf, 0, NULL)) return 1; } return 0; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 0b21d7e5b2..c824d4ec5f 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -87,7 +87,7 @@ static int subpath_matches(const char *path, const char *filter) const char *subpath = path; while (subpath) { - if (!fnmatch(filter, subpath, 0)) + if (!wildmatch(filter, subpath, 0, NULL)) return subpath - path; subpath = strchr(subpath, '/'); if (subpath) diff --git a/builtin/reflog.c b/builtin/reflog.c index 852cff60b7..c12a9784e6 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -561,7 +561,7 @@ static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, int slot, c return; /* both given explicitly -- nothing to tweak */ for (ent = reflog_expire_cfg; ent; ent = ent->next) { - if (!fnmatch(ent->pattern, ref, 0)) { + if (!wildmatch(ent->pattern, ref, 0, NULL)) { if (!(slot & EXPIRE_TOTAL)) cb->expire_total = ent->expire_total; if (!(slot & EXPIRE_UNREACH)) diff --git a/builtin/replace.c b/builtin/replace.c index 2336325ce3..80b152a86c 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -36,7 +36,7 @@ static int show_reference(const char *refname, const unsigned char *sha1, { struct show_data *data = cb_data; - if (!fnmatch(data->pattern, refname, 0)) { + if (!wildmatch(data->pattern, refname, 0, NULL)) { if (data->format == REPLACE_FORMAT_SHORT) printf("%s\n", refname); else if (data->format == REPLACE_FORMAT_MEDIUM) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index d9217ce1e1..d87317290c 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -450,7 +450,7 @@ static int append_matching_ref(const char *refname, const unsigned char *sha1, i slash--; if (!*tail) return 0; - if (fnmatch(match_ref_pattern, tail, 0)) + if (wildmatch(match_ref_pattern, tail, 0, NULL)) return 0; if (starts_with(refname, "refs/heads/")) return append_head_ref(refname, sha1, flag, cb_data); diff --git a/builtin/tag.c b/builtin/tag.c index 74d3780b77..169c676636 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -42,7 +42,7 @@ static int match_pattern(const char **patterns, const char *ref) if (!*patterns) return 1; for (; *patterns; patterns++) - if (!fnmatch(*patterns, ref, 0)) + if (!wildmatch(*patterns, ref, 0, NULL)) return 1; return 0; } diff --git a/diffcore-order.c b/diffcore-order.c index fe7f1f4647..53ea4d14c2 100644 --- a/diffcore-order.c +++ b/diffcore-order.c @@ -73,7 +73,7 @@ static int match_order(const char *path) strbuf_addstr(&p, path); while (p.buf[0]) { char *cp; - if (!fnmatch(order[i], p.buf, 0)) + if (!wildmatch(order[i], p.buf, 0, NULL)) return i; cp = strrchr(p.buf, '/'); if (!cp) @@ -49,7 +49,9 @@ int strncmp_icase(const char *a, const char *b, size_t count) int fnmatch_icase(const char *pattern, const char *string, int flags) { - return fnmatch(pattern, string, flags | (ignore_case ? FNM_CASEFOLD : 0)); + return wildmatch(pattern, string, + flags | (ignore_case ? WM_CASEFOLD : 0), + NULL); } inline int git_fnmatch(const struct pathspec_item *item, @@ -58,7 +60,7 @@ inline int git_fnmatch(const struct pathspec_item *item, { if (prefix > 0) { if (ps_strncmp(item, pattern, string, prefix)) - return FNM_NOMATCH; + return WM_NOMATCH; pattern += prefix; string += prefix; } @@ -76,8 +78,9 @@ inline int git_fnmatch(const struct pathspec_item *item, NULL); else /* wildmatch has not learned no FNM_PATHNAME mode yet */ - return fnmatch(pattern, string, - item->magic & PATHSPEC_ICASE ? FNM_CASEFOLD : 0); + return wildmatch(pattern, string, + item->magic & PATHSPEC_ICASE ? WM_CASEFOLD : 0, + NULL); } static int fnmatch_icase_mem(const char *pattern, int patternlen, @@ -1477,7 +1477,7 @@ static int filter_refs(const char *refname, const unsigned char *sha1, int flags void *data) { struct ref_filter *filter = (struct ref_filter *)data; - if (fnmatch(filter->pattern, refname, 0)) + if (wildmatch(filter->pattern, refname, 0, NULL)) return 0; return filter->fn(refname, sha1, flags, filter->cb_data); } diff --git a/revision.c b/revision.c index a0df72f32c..6addff1b5f 100644 --- a/revision.c +++ b/revision.c @@ -1191,7 +1191,7 @@ int ref_excluded(struct string_list *ref_excludes, const char *path) if (!ref_excludes) return 0; for_each_string_list_item(item, ref_excludes) { - if (!fnmatch(item->string, path, 0)) + if (!wildmatch(item->string, path, 0, NULL)) return 1; } return 0; |