Skip to content

Commit 898bbd9

Browse files
pcloudsgitster
authored andcommitted
Convert ce_path_match() to use match_pathspec_depth()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eb9cb55 commit 898bbd9

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

read-cache.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -708,29 +708,7 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
708708

709709
int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
710710
{
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);
734712
}
735713

736714
/*

0 commit comments

Comments
 (0)