git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] wt-status: Show ignored files in untracked dirs

From
Antoine Pelisse <apelisse@gmail.com>
Date
Dec 26, 2012, 13:31 UTC
Message-ID
<1356528674-2730-1-git-send-email-apelisse@gmail.com>
In-Reply-To
<1356516985-31068-1-git-send-email-apelisse@gmail.com>

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 <apelisse@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
Previous: Antoine PelisseNext: Junio C Hamano
Message 3 of 16 in “Bug in git status”
  1. Michael HaggertyDec 26, 2012
  2. wt-status: Show ignored files in untracked dirsAntoine Pelisse, Dec 26, 2012
  3. wt-status: Show ignored files in untracked dirsAntoine Pelisse, Dec 26, 2012
  4. Junio C HamanoDec 27, 2012
  5. Jeff KingDec 27, 2012
  6. Junio C HamanoDec 27, 2012
  7. Antoine PelisseDec 27, 2012
  8. Jeff KingDec 27, 2012
  9. Antoine PelisseDec 27, 2012
  10. Antoine PelisseDec 28, 2012
  11. Jeff KingDec 29, 2012
  12. 1/2 dir.c: Make git-status --ignored more consistentAntoine Pelisse, Dec 30, 2012
  13. 2/2 git-status: Test --ignored behaviorAntoine Pelisse, Dec 30, 2012
  14. Antoine PelisseDec 30, 2012
  15. Adam SpiersDec 30, 2012
  16. Junio C HamanoDec 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.