[PATCH 1/5] pathspec: mark wildcard pathspecs from the beginning
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
match_pathspec() should be converted to use this as well. Not now
though.
cache.h | 2 ++
dir.c | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/cache.h b/cache.h
index 045c9fc..7a3e0a0 100644
--- a/cache.h
+++ b/cache.h
@@ -495,8 +495,10 @@ extern int ie_modified(const struct index_state *, struct cache_entry *, struct
struct pathspec {
const char **raw;
int nr;
+ int has_wildcard:1;
struct pathspec_item {
int len;
+ int has_wildcard:1;
} *items;
};
diff --git a/dir.c b/dir.c
index 80b2df2..a44c7b3 100644
--- a/dir.c
+++ b/dir.c
@@ -1088,7 +1088,12 @@ 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++) {
- pathspec->items[i].len = strlen(paths[i]);
+ struct pathspec_item *item = pathspec->items+i;
+
+ item->len = strlen(paths[i]);
+ item->has_wildcard = !no_wildcard(paths[i]);
+ if (item->has_wildcard)
+ pathspec->has_wildcard = 1;
}
return 0;
}
--
1.7.1.rc1.70.g788ca