diff options
author | Elijah Newren <newren@gmail.com> | 2021-05-12 19:28:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-13 01:45:03 +0200 |
commit | dd55fc0df15c338a8dbec6dec6ca6b58edc8acef (patch) | |
tree | 59eba3ec0924940c5c68e54c6a1820022edc0833 /dir.c | |
parent | dir: avoid unnecessary traversal into ignored directory (diff) | |
download | git-dd55fc0df15c338a8dbec6dec6ca6b58edc8acef.tar.xz git-dd55fc0df15c338a8dbec6dec6ca6b58edc8acef.zip |
dir: traverse into untracked directories if they may have ignored subfiles
A directory that is untracked does not imply that all files under it
should be categorized as untracked; in particular, if the caller is
interested in ignored files, many files or directories underneath the
untracked directory may be ignored. We previously partially handled
this right with DIR_SHOW_IGNORED_TOO, but missed DIR_SHOW_IGNORED. It
was not obvious, though, because the logic for untracked and excluded
files had been fused together making it harder to reason about. The
previous commit split that logic out, making it easier to notice that
DIR_SHOW_IGNORED was missing. Add it.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1868,15 +1868,17 @@ static enum path_treatment treat_directory(struct dir_struct *dir, /* * Other than the path_recurse case above, we only need to - * recurse into untracked directories if either of the following + * recurse into untracked directories if any of the following * bits is set: - * - DIR_SHOW_IGNORED_TOO (because then we need to determine if - * there are ignored entries below) + * - DIR_SHOW_IGNORED (because then we need to determine if + * there are ignored entries below) + * - DIR_SHOW_IGNORED_TOO (same as above) * - DIR_HIDE_EMPTY_DIRECTORIES (because we have to determine if * the directory is empty) */ if (!excluded && - !(dir->flags & (DIR_SHOW_IGNORED_TOO | + !(dir->flags & (DIR_SHOW_IGNORED | + DIR_SHOW_IGNORED_TOO | DIR_HIDE_EMPTY_DIRECTORIES))) { return path_untracked; } |