diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-06-25 12:27:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-25 12:27:45 -0700 |
commit | 53674699c0b40c99094858d0c174e8ff0a162a8d (patch) | |
tree | 1bd447865fb01f9014bd329832690f27e8673a9d /dir.c | |
parent | Merge branch 'jk/complete-git-switch' (diff) | |
parent | clean: optimize and document cases where we recurse into subdirectories (diff) | |
download | tgif-53674699c0b40c99094858d0c174e8ff0a162a8d.tar.xz |
Merge branch 'en/clean-cleanups'
Code clean-up of "git clean" resulted in a fix of recent
performance regression.
* en/clean-cleanups:
clean: optimize and document cases where we recurse into subdirectories
clean: consolidate handling of ignored parameters
dir, clean: avoid disallowed behavior
dir: fix a few confusing comments
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -193,6 +193,10 @@ int fill_directory(struct dir_struct *dir, const char *prefix; size_t prefix_len; + unsigned exclusive_flags = DIR_SHOW_IGNORED | DIR_SHOW_IGNORED_TOO; + if ((dir->flags & exclusive_flags) == exclusive_flags) + BUG("DIR_SHOW_IGNORED and DIR_SHOW_IGNORED_TOO are exclusive"); + /* * Calculate common prefix for the pathspec, and * use that to optimize the directory walk @@ -1836,7 +1840,7 @@ static enum path_treatment treat_directory(struct dir_struct *dir, * to recurse into untracked/ignored directories if either of the * following bits is set: * - DIR_SHOW_IGNORED_TOO (because then we need to determine if - * there are ignored directories below) + * there are ignored entries below) * - DIR_HIDE_EMPTY_DIRECTORIES (because we have to determine if * the directory is empty) */ @@ -1854,10 +1858,11 @@ static enum path_treatment treat_directory(struct dir_struct *dir, return path_excluded; /* - * If we have we don't want to know the all the paths under an - * untracked or ignored directory, we still need to go into the - * directory to determine if it is empty (because an empty directory - * should be path_none instead of path_excluded or path_untracked). + * Even if we don't want to know all the paths under an untracked or + * ignored directory, we may still need to go into the directory to + * determine if it is empty (because with DIR_HIDE_EMPTY_DIRECTORIES, + * an empty directory should be path_none instead of path_excluded or + * path_untracked). */ check_only = ((dir->flags & DIR_HIDE_EMPTY_DIRECTORIES) && !(dir->flags & DIR_SHOW_IGNORED_TOO)); |