diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/add.c | 5 | ||||
-rw-r--r-- | builtin/check-ignore.c | 7 | ||||
-rw-r--r-- | builtin/ls-files.c | 15 |
3 files changed, 6 insertions, 21 deletions
diff --git a/builtin/add.c b/builtin/add.c index 54cd2d417d..d4b40f2b7a 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -545,9 +545,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (pathspec) { int i; - struct path_exclude_check check; - path_exclude_check_init(&check, &dir); if (!seen) seen = find_pathspecs_matching_against_index(pathspec); for (i = 0; pathspec[i]; i++) { @@ -555,7 +553,7 @@ int cmd_add(int argc, const char **argv, const char *prefix) && !file_exists(pathspec[i])) { if (ignore_missing) { int dtype = DT_UNKNOWN; - if (is_path_excluded(&check, pathspec[i], -1, &dtype)) + if (is_excluded(&dir, pathspec[i], &dtype)) dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i])); } else die(_("pathspec '%s' did not match any files"), @@ -563,7 +561,6 @@ int cmd_add(int argc, const char **argv, const char *prefix) } } free(seen); - path_exclude_check_clear(&check); } plug_bulk_checkin(); diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 0240f99b57..854a88a056 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -59,7 +59,6 @@ static int check_ignore(const char *prefix, const char **pathspec) const char *path, *full_path; char *seen; int num_ignored = 0, dtype = DT_UNKNOWN, i; - struct path_exclude_check check; struct exclude *exclude; /* read_cache() is only necessary so we can watch out for submodules. */ @@ -67,7 +66,6 @@ static int check_ignore(const char *prefix, const char **pathspec) die(_("index file corrupt")); memset(&dir, 0, sizeof(dir)); - dir.flags |= DIR_COLLECT_IGNORED; setup_standard_excludes(&dir); if (!pathspec || !*pathspec) { @@ -76,7 +74,6 @@ static int check_ignore(const char *prefix, const char **pathspec) return 0; } - path_exclude_check_init(&check, &dir); /* * look for pathspecs matching entries in the index, since these * should not be ignored, in order to be consistent with @@ -90,8 +87,7 @@ static int check_ignore(const char *prefix, const char **pathspec) full_path = check_path_for_gitlink(full_path); die_if_path_beyond_symlink(full_path, prefix); if (!seen[i]) { - exclude = last_exclude_matching_path(&check, full_path, - -1, &dtype); + exclude = last_exclude_matching(&dir, full_path, &dtype); if (exclude) { if (!quiet) output_exclude(path, exclude); @@ -101,7 +97,6 @@ static int check_ignore(const char *prefix, const char **pathspec) } free(seen); clear_directory(&dir); - path_exclude_check_clear(&check); return num_ignored; } diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 175e6e3e72..22020729cb 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -201,19 +201,15 @@ static void show_ru_info(void) } } -static int ce_excluded(struct path_exclude_check *check, struct cache_entry *ce) +static int ce_excluded(struct dir_struct *dir, struct cache_entry *ce) { int dtype = ce_to_dtype(ce); - return is_path_excluded(check, ce->name, ce_namelen(ce), &dtype); + return is_excluded(dir, ce->name, &dtype); } static void show_files(struct dir_struct *dir) { int i; - struct path_exclude_check check; - - if ((dir->flags & DIR_SHOW_IGNORED)) - path_exclude_check_init(&check, dir); /* For cached/deleted files we don't need to even do the readdir */ if (show_others || show_killed) { @@ -227,7 +223,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) && - !ce_excluded(&check, ce)) + !ce_excluded(dir, ce)) continue; if (show_unmerged && !ce_stage(ce)) continue; @@ -243,7 +239,7 @@ static void show_files(struct dir_struct *dir) struct stat st; int err; if ((dir->flags & DIR_SHOW_IGNORED) && - !ce_excluded(&check, ce)) + !ce_excluded(dir, ce)) continue; if (ce->ce_flags & CE_UPDATE) continue; @@ -256,9 +252,6 @@ static void show_files(struct dir_struct *dir) show_ce_entry(tag_modified, ce); } } - - if ((dir->flags & DIR_SHOW_IGNORED)) - path_exclude_check_clear(&check); } /* |