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

[PATCH 3/5] wt-status: collect ignored files

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 10, 2010, 07:40 UTC
Message-ID
<1270885256-31589-4-git-send-email-gitster@pobox.com>
In-Reply-To
<1270885256-31589-1-git-send-email-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 wt-status.c |   16 ++++++++++++++++
 wt-status.h |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index c88159a..f13c7da 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -42,6 +42,7 @@ void wt_status_prepare(struct wt_status *s)
 	s->index_file = get_index_file();
 	s->change.strdup_strings = 1;
 	s->untracked.strdup_strings = 1;
+	s->ignored.strdup_strings = 1;
 }
 
 static void wt_status_print_unmerged_header(struct wt_status *s)
@@ -382,6 +383,21 @@ static void wt_status_collect_untracked(struct wt_status *s)
 		free(ent);
 	}
 
+	if (s->show_ignored_files) {
+		dir.nr = 0;
+		dir.flags = DIR_SHOW_IGNORED | DIR_SHOW_OTHER_DIRECTORIES;
+		fill_directory(&dir, s->pathspec);
+		for (i = 0; i < dir.nr; i++) {
+			struct dir_entry *ent = dir.entries[i];
+			if (!cache_name_is_other(ent->name, ent->len))
+				continue;
+			if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
+				continue;
+			string_list_insert(ent->name, &s->ignored);
+			free(ent);
+		}
+	}
+
 	free(dir.entries);
 }
 
diff --git a/wt-status.h b/wt-status.h
index 2c49f46..1093e65 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -41,6 +41,7 @@ struct wt_status {
 	int use_color;
 	int relative_paths;
 	int submodule_summary;
+	int show_ignored_files;
 	enum untracked_status_type show_untracked_files;
 	char color_palette[WT_STATUS_UNMERGED+1][COLOR_MAXLEN];
 
@@ -52,6 +53,7 @@ struct wt_status {
 	const char *prefix;
 	struct string_list change;
 	struct string_list untracked;
+	struct string_list ignored;
 };
 
 void wt_status_prepare(struct wt_status *s);
-- 
1.7.1.rc0.264.g94f6e
Previous: Junio C HamanoNext: Jeff King
Message 4 of 14 in “"status --ignored"”
  1. 0/5 "status --ignored"Junio C Hamano, Apr 10, 2010
  2. 1/5 wt-status: remove unused workdir_untracked fieldJunio C Hamano, Apr 10, 2010
  3. 2/5 wt-status: plug memory leak while collecting untracked filesJunio C Hamano, Apr 10, 2010
  4. 3/5 wt-status: collect ignored filesJunio C Hamano, Apr 10, 2010
  5. Jeff KingApr 10, 2010
  6. 4/5 wt-status: rename and restructure status-print-untrackedJunio C Hamano, Apr 10, 2010
  7. 5/5 status: --ignored option shows ignored filesJunio C Hamano, Apr 10, 2010
  8. Jeff KingApr 10, 2010
  9. Junio C HamanoApr 10, 2010
  10. Jeff KingApr 10, 2010
  11. Eric RaymondApr 10, 2010
  12. Junio C HamanoApr 10, 2010
  13. Jakub NarebskiApr 10, 2010
  14. Jeff KingApr 11, 2010

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.