Make "ce_match_path()" a generic helper function

... and make git-diff-files use it too.  This all _should_ make the
diffcore-pathspec.c phase unnecessary, since the diff'ers now all do the
path matching early interally.
This commit is contained in:
Linus Torvalds
2005-07-14 16:55:06 -07:00
parent fdee7d07ba
commit c0fd1f517e
4 changed files with 33 additions and 23 deletions

View File

@ -87,28 +87,6 @@ static int show_modified(struct cache_entry *old,
return 0;
}
static int ce_path_match(const struct cache_entry *ce, const char **pathspec)
{
const char *match, *name;
int len;
if (!pathspec)
return 1;
len = ce_namelen(ce);
name = ce->name;
while ((match = *pathspec++) != NULL) {
int matchlen = strlen(match);
if (matchlen > len)
continue;
if (memcmp(name, match, matchlen))
continue;
if (name[matchlen] == '/' || !name[matchlen])
return 1;
}
return 0;
}
static int diff_cache(struct cache_entry **ac, int entries, const char **pathspec)
{
while (entries) {