aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-12-15 22:02:50 +0700
committerJunio C Hamano <gitster@pobox.com>2011-02-03 14:08:30 -0800
commit898bbd9fb4c749afbddcb8a6b68a64b394366e44 (patch)
tree2397c7aec6e1e2c324533d0c55118c9289a808ff /read-cache.c
parenteb9cb55b944796374402ab4e2639300dc9b0b409 (diff)
downloadgit-898bbd9fb4c749afbddcb8a6b68a64b394366e44.tar.gz
git-898bbd9fb4c749afbddcb8a6b68a64b394366e44.tar.xz
Convert ce_path_match() to use match_pathspec_depth()
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 'read-cache.c')
-rw-r--r--read-cache.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/read-cache.c b/read-cache.c
index 8b2d537f0..7772079ad 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -708,29 +708,7 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
{
- const char *match, *name;
- const char **ps = pathspec->raw;
- int len;
-
- if (!pathspec->nr)
- return 1;
-
- len = ce_namelen(ce);
- name = ce->name;
- while ((match = *ps++) != NULL) {
- int matchlen = strlen(match);
- if (matchlen > len)
- continue;
- if (memcmp(name, match, matchlen))
- continue;
- if (matchlen && name[matchlen-1] == '/')
- return 1;
- if (name[matchlen] == '/' || !name[matchlen])
- return 1;
- if (!matchlen)
- return 1;
- }
- return 0;
+ return match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL);
}
/*