summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-06-07 07:53:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-06-07 18:33:37 (GMT)
commitfcd631ed84d61147b7cc8996cde533f8a8d1fca0 (patch)
tree8805b3d101b59ef82bb99db033d0c66893085830 /dir.c
parent35a94d44afd5d46bd9675d74925bac73a9839066 (diff)
downloadgit-fcd631ed84d61147b7cc8996cde533f8a8d1fca0.zip
git-fcd631ed84d61147b7cc8996cde533f8a8d1fca0.tar.gz
git-fcd631ed84d61147b7cc8996cde533f8a8d1fca0.tar.bz2
dir.c: get rid of the wildcard symbol set in no_wildcard()
Elsewhere in this file is_glob_special() is also used to check for wildcards, which is defined in ctype. Make no_wildcard() also use this function (indirectly via simple_length()) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/dir.c b/dir.c
index e756de1..bbf958c 100644
--- a/dir.c
+++ b/dir.c
@@ -288,9 +288,24 @@ int match_pathspec_depth(const struct pathspec *ps,
return retval;
}
+/*
+ * Return the length of the "simple" part of a path match limiter.
+ */
+static int simple_length(const char *match)
+{
+ int len = -1;
+
+ for (;;) {
+ unsigned char c = *match++;
+ len++;
+ if (c == '\0' || is_glob_special(c))
+ return len;
+ }
+}
+
static int no_wildcard(const char *string)
{
- return string[strcspn(string, "*?[{\\")] == '\0';
+ return string[simple_length(string)] == '\0';
}
void add_exclude(const char *string, const char *base,
@@ -997,21 +1012,6 @@ static int cmp_name(const void *p1, const void *p2)
e2->name, e2->len);
}
-/*
- * Return the length of the "simple" part of a path match limiter.
- */
-static int simple_length(const char *match)
-{
- int len = -1;
-
- for (;;) {
- unsigned char c = *match++;
- len++;
- if (c == '\0' || is_glob_special(c))
- return len;
- }
-}
-
static struct path_simplify *create_simplify(const char **pathspec)
{
int nr, alloc = 0;