Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> writes: > Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> > diff --git a/dir.c b/dir.c > index 646c79f..0987d0c 100644 > --- a/dir.c > +++ b/dir.c > @@ -1089,8 +1089,17 @@ int init_pathspec(struct pathspec *pathspec, const char **paths) > pathspec->items = xmalloc(sizeof(struct pathspec_item)*pathspec->nr); > for (i = 0; i < pathspec->nr; i++) { > struct pathspec_item *item = pathspec->items+i; > - > - item->len = strlen(paths[i]); > + const char *path = paths[i]; > + > + item->len = strlen(path); > + item->has_wildcard = !no_wildcard(path); > + if (item->has_wildcard) { > + pathspec->has_wildcard = 1; > + item->prefix_len = 0; > + while (item->prefix_len < item->len && > + strchr("*?[{\\", path[item->prefix_len]) == NULL) > + item->prefix_len++; > + } Would it make sense to use strcspn(3) here? > } > return 0; > } > -- > 1.7.3.3.476.g10a82 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html