path_excluded(): update API to less cache-entry centric

It was stupid of me to make the API too much cache-entry specific;
the caller may want to check arbitrary pathname without having a
corresponding cache-entry to see if a path is ignored.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2012-06-05 21:17:52 -07:00
parent 93921b07e9
commit 782cd4c0f6
3 changed files with 30 additions and 15 deletions

View File

@ -200,6 +200,12 @@ static void show_ru_info(void)
}
}
static int ce_excluded(struct path_exclude_check *check, struct cache_entry *ce)
{
int dtype = ce_to_dtype(ce);
return path_excluded(check, ce->name, ce_namelen(ce), &dtype);
}
static void show_files(struct dir_struct *dir)
{
int i;
@ -220,7 +226,7 @@ static void show_files(struct dir_struct *dir)
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
if ((dir->flags & DIR_SHOW_IGNORED) &&
!path_excluded(&check, ce))
!ce_excluded(&check, ce))
continue;
if (show_unmerged && !ce_stage(ce))
continue;
@ -236,7 +242,7 @@ static void show_files(struct dir_struct *dir)
struct stat st;
int err;
if ((dir->flags & DIR_SHOW_IGNORED) &&
!path_excluded(&check, ce))
!ce_excluded(&check, ce))
continue;
if (ce->ce_flags & CE_UPDATE)
continue;