@matheusbsbs / matheus-bagliano / commits / 898bbd9fb4
Fork 0

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>

Nguyễn Thái Ngọc Duy committed Dec 15, 2010 at 22:02 UTC 898bbd9fb4c749afbddcb8a6b68a64b394366e44
1 file changed +1 -23
read-cache.c
+1 -23
@@ -708,29 +708,7 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
708
709 int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
710 {
711 - const char *match, *name;
712 - const char **ps = pathspec->raw;
713 - int len;
714 -
715 - if (!pathspec->nr)
716 - return 1;
717 -
718 - len = ce_namelen(ce);
719 - name = ce->name;
720 - while ((match = *ps++) != NULL) {
721 - int matchlen = strlen(match);
722 - if (matchlen > len)
723 - continue;
724 - if (memcmp(name, match, matchlen))
725 - continue;
726 - if (matchlen && name[matchlen-1] == '/')
727 - return 1;
728 - if (name[matchlen] == '/' || !name[matchlen])
729 - return 1;
730 - if (!matchlen)
731 - return 1;
732 - }
733 - return 0;
711 + return match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL);
712 }
713
714 /*