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

[PATCH 4/6] Expand support for ignored arguments on status

From
Jjameson.miller81@gmail.com <jameson.miller81@gmail.com>
Date
Oct 5, 2017, 20:54 UTC
Message-ID
<20171005205443.206900-5-jameson.miller81@gmail.com>
In-Reply-To
<20171005205443.206900-1-jameson.miller81@gmail.com>
From: Jameson Miller <jamill@microsoft.com>

Teach status command to handle matching ignored mode when showing untracked files with the normal option.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
---
 dir.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dir.c b/dir.c
index b9af87eca9..8636d080b2 100644
--- a/dir.c
+++ b/dir.c
@@ -1585,6 +1585,7 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
 {
 	int exclude;
 	int has_path_in_index = !!index_file_exists(istate, path->buf, path->len, ignore_case);
+	enum path_treatment path_treatment;
 
 	if (dtype == DT_UNKNOWN)
 		dtype = get_dtype(de, istate, path->buf, path->len);
@@ -1631,8 +1632,23 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
 		return path_none;
 	case DT_DIR:
 		strbuf_addch(path, '/');
-		return treat_directory(dir, istate, untracked, path->buf, path->len,
-				       baselen, exclude, pathspec);
+		path_treatment = treat_directory(dir, istate, untracked,
+						 path->buf, path->len,
+						 baselen, exclude, pathspec);
+		/*
+		 * If we are only want to return directories that
+		 * match an exclude pattern, and this directories does
+		 * not match an exclude pattern but all contents are
+		 * excluded, then indicate that we should recurse into
+		 * this directory (instead of marking the directory
+		 * itself as an ignored path)
+		 */
+		if (!exclude &&
+		    path_treatment == path_excluded &&
+		    (dir->flags & DIR_SHOW_IGNORED_TOO) &&
+		    (dir->flags & DIR_SHOW_IGNORED_TOO_MODE_MATCHING))
+			return path_recurse;
+		return path_treatment;
 	case DT_REG:
 	case DT_LNK:
 		return exclude ? path_excluded : path_untracked;
-- 
2.13.6
Previous: Stefan BellerNext: jameson.miller81@gmail.com
Message 7 of 49 in “Teach Status options around showing ignored files”
  1. 0/6 Teach Status options around showing ignored filesjameson.miller81@gmail.com, Oct 5, 2017
  2. 3/6 Add tests for git status `--ignored=matching`jameson.miller81@gmail.com, Oct 5, 2017
  3. Stefan BellerOct 5, 2017
  4. 5/6 Add tests around status handling of ignored argumentsjameson.miller81@gmail.com, Oct 5, 2017
  5. 6/6 Handle unsupported combination status argumentsjameson.miller81@gmail.com, Oct 5, 2017
  6. Stefan BellerOct 5, 2017
  7. 4/6 Expand support for ignored arguments on statusjameson.miller81@gmail.com, Oct 5, 2017
  8. 1/6 Teach status options around showing ignored filesjameson.miller81@gmail.com, Oct 5, 2017
  9. 2/6 Update documentation for new directory and status logicjameson.miller81@gmail.com, Oct 5, 2017
  10. Stefan BellerOct 5, 2017
  11. Jonathan NiederOct 5, 2017
  12. Jameson MillerOct 5, 2017
  13. 0/5 Teach Status options around showing ignored filesJameson Miller, Oct 11, 2017
  14. 1/5 Teach status options around showing ignored filesJameson Miller, Oct 11, 2017
  15. Junio C HamanoOct 12, 2017
  16. Jameson MillerOct 12, 2017
  17. 2/5 Update documentation for new directory and status logicJameson Miller, Oct 11, 2017
  18. Junio C HamanoOct 12, 2017
  19. Jameson MillerOct 12, 2017
  20. Junio C HamanoOct 13, 2017
  21. 5/5 Add tests around status handling of ignored argumentsJameson Miller, Oct 11, 2017
  22. Junio C HamanoOct 12, 2017
  23. Jameson MillerOct 12, 2017
  24. Junio C HamanoOct 13, 2017
  25. 4/5 Expand support for ignored arguments on statusJameson Miller, Oct 11, 2017
  26. Junio C HamanoOct 12, 2017
  27. 3/5 Add tests for git status `--ignored=matching`Jameson Miller, Oct 11, 2017
  28. Junio C HamanoOct 12, 2017
  29. Jameson MillerOct 12, 2017
  30. 0/4 status: add option to show ignored files differentlyJameson Miller, Oct 19, 2017
  31. 1/4 status: add option to show ignored files differentlyJameson Miller, Oct 19, 2017
  32. Junio C HamanoOct 23, 2017
  33. 2/4 status: report matching ignored and normal untrackedJameson Miller, Oct 19, 2017
  34. 3/4 status: document options to show matching ignored filesJameson Miller, Oct 19, 2017
  35. 4/4 status: test --ignored=matchingJameson Miller, Oct 19, 2017
  36. Stefan BellerOct 19, 2017
  37. Junio C HamanoOct 22, 2017
  38. Junio C HamanoOct 23, 2017
  39. 0/4 status: add option to show ignored files differentlyJameson Miller, Oct 23, 2017
  40. 1/4 status: add option to show ignored files differentlyJameson Miller, Oct 23, 2017
  41. 3/4 status: document options to show matching ignored filesJameson Miller, Oct 23, 2017
  42. 2/4 status: report matching ignored and normal untrackedJameson Miller, Oct 23, 2017
  43. 4/4 status: test ignored modesJameson Miller, Oct 23, 2017
  44. 0/4 status: add option to show ignored files differentlyjameson.miller81@gmail.com, Oct 30, 2017
  45. 3/4 status: document options to show matching ignored filesjameson.miller81@gmail.com, Oct 30, 2017
  46. 4/4 status: test ignored modesjameson.miller81@gmail.com, Oct 30, 2017
  47. 2/4 status: report matching ignored and normal untrackedjameson.miller81@gmail.com, Oct 30, 2017
  48. 1/4 status: add option to show ignored files differentlyjameson.miller81@gmail.com, Oct 30, 2017
  49. Junio C HamanoOct 31, 2017

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.