When looking for ignored files, we do not recurse into untracked
directory, and simply consider the directory ignored status.
As a consequence, we don't see ignored files in those directories.

Change that behavior by recursing into untracked directories, if not
ignored themselves, searching for ignored files.

Signed-off-by: Antoine Pelisse <apeli...@gmail.com>
---
Actually, the previous patch breaks the case where the directory is ignored.
This one should fix both issues.
Let me know if you see any other use case that could be an issue.

 dir.c       | 7 +++++++
 wt-status.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dir.c b/dir.c
index 5a83aa7..2863799 100644
--- a/dir.c
+++ b/dir.c
@@ -1042,6 +1042,13 @@ static enum path_treatment treat_one_path(struct 
dir_struct *dir,
                        return path_ignored;
        }

+       /*
+        * Don't recurse into ignored directories when looking for
+        * ignored files, but still show the directory as ignored.
+        */
+       if (exclude && (dir->flags & DIR_SHOW_IGNORED) && dtype == DT_DIR)
+               return path_handled;
+
        switch (dtype) {
        default:
                return path_ignored;
diff --git a/wt-status.c b/wt-status.c
index 2a9658b..7c41488 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -516,7 +516,7 @@ static void wt_status_collect_untracked(struct wt_status *s)

        if (s->show_ignored_files) {
                dir.nr = 0;
-               dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
+               dir.flags = DIR_SHOW_IGNORED;
                fill_directory(&dir, s->pathspec);
                for (i = 0; i < dir.nr; i++) {
                        struct dir_entry *ent = dir.entries[i];
--
1.8.1.rc3.12.g8864e38

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to