aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-06-05 21:17:52 -0700
committerJunio C Hamano <gitster@pobox.com>2012-06-05 21:22:36 -0700
commit782cd4c0f6e0fef5147cb738009dde6e778f4932 (patch)
tree98a8b6e49990982df90775ae74d9596cd774822d /builtin
parent93921b07e985de38f7af6689d81e5c7dfb3f8aa0 (diff)
downloadgit-782cd4c0f6e0fef5147cb738009dde6e778f4932.tar.gz
git-782cd4c0f6e0fef5147cb738009dde6e778f4932.tar.xz
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/ls-files.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 90dc3601a..31b3f2d90 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -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;