pathspec: save the non-wildcard length part
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index 5a83aa7897f270279c403778f43aea6db1efc5af..c391d46b2fc09bb242419513b2b6f2c422859eb9 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -230,7 +230,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
                        return MATCHED_RECURSIVELY;
        }
 
-       if (item->use_wildcard && !fnmatch(match, name, 0))
+       if (item->nowildcard_len < item->len && !fnmatch(match, name, 0))
                return MATCHED_FNMATCH;
 
        return 0;
@@ -1429,8 +1429,8 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)
 
                item->match = path;
                item->len = strlen(path);
-               item->use_wildcard = !no_wildcard(path);
-               if (item->use_wildcard)
+               item->nowildcard_len = simple_length(path);
+               if (item->nowildcard_len < item->len)
                        pathspec->has_wildcard = 1;
        }