From df5bcdf83aeb94718602ebc8c0f597166bb493f1 Mon Sep 17 00:00:00 2001 From: Samuel Lijin Date: Thu, 18 May 2017 04:21:51 -0400 Subject: dir: recurse into untracked dirs for ignored files We consider directories containing only untracked and ignored files to be themselves untracked, which in the usual case means we don't have to search these directories. This is problematic when we want to collect ignored files with DIR_SHOW_IGNORED_TOO, though, so we teach read_directory_recursive() to recurse into untracked directories to find the ignored files they contain when DIR_SHOW_IGNORED_TOO is set. This has the side effect of also collecting all untracked files in untracked directories as well. Signed-off-by: Samuel Lijin Signed-off-by: Junio C Hamano --- dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index aeeb5ce104..6b4eeef584 100644 --- a/dir.c +++ b/dir.c @@ -1747,7 +1747,10 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir, dir_state = state; /* recurse into subdir if instructed by treat_path */ - if (state == path_recurse) { + if ((state == path_recurse) || + ((state == path_untracked) && + (dir->flags & DIR_SHOW_IGNORED_TOO) && + (get_dtype(cdir.de, path.buf, path.len) == DT_DIR))) { struct untracked_cache_dir *ud; ud = lookup_untracked(dir->untracked, untracked, path.buf + baselen, -- cgit v1.2.1