diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-23 11:21:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-23 11:21:23 -0700 |
commit | 7093d2c0dd986c70a98b712440b34f98599b3539 (patch) | |
tree | d4c22d38c71d388dce709fc36d6318ca873f9570 /builtin/ls-files.c | |
parent | 9e94f9ba9e902d48c75df6ba53e6e87cefe187a8 (diff) | |
parent | 0aaf62b6e018484bad9cea47dc00644d57b7ad49 (diff) | |
download | git-7093d2c0dd986c70a98b712440b34f98599b3539.tar.gz |
Merge branch 'kb/status-ignored-optim-2'
Fixes a handful of issues in the code to traverse working tree to
find untracked and/or ignored files, cleans up and optimizes the
codepath in general.
* kb/status-ignored-optim-2:
dir.c: git-status --ignored: don't scan the work tree twice
dir.c: git-status --ignored: don't scan the work tree three times
dir.c: git-status: avoid is_excluded checks for tracked files
dir.c: replace is_path_excluded with now equivalent is_excluded API
dir.c: unify is_excluded and is_path_excluded APIs
dir.c: move prep_exclude
dir.c: factor out parts of last_exclude_matching for later reuse
dir.c: git-clean -d -X: don't delete tracked directories
dir.c: make 'git-status --ignored' work within leading directories
dir.c: git-status --ignored: don't list empty directories as ignored
dir.c: git-ls-files --directories: don't hide empty directories
dir.c: git-status --ignored: don't list empty ignored directories
dir.c: git-status --ignored: don't list files in ignored directories
dir.c: git-status --ignored: don't drop ignored directories
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r-- | builtin/ls-files.c | 15 |
1 files changed, 4 insertions, 11 deletions
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); } /* |