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

[PATCH v2 2/5] read-cache: add/read-cache respect submodule ignore=all

From
CGClaus Schneider(Eficode) via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 13, 2025, 18:10 UTC
Message-ID
<9ec79b9a116a1dda9fe7bd10d16c1faf77f778ed.1763057433.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1987.v2.git.1763057433.gitgitgadget@gmail.com>
From: "Claus Schneider(Eficode)" <claus.schneider@eficode.com>

Submodules configured with ignore=all are now skipped during add operations unless overridden by --include-ignored-submodules and the submodule path is explicitly specified.

A message is printed (like ignored files) guiding the user to use the --include-ignored-submodules flag if the user has explicitely want to update the submodule reference.

The reason for the change is support submodule branch tracking or similar and git status state nothing and git add should not add either. The workflow is more logic and similar to regular ignored files even the submodule is already tracked.

The change opens up a lot of possibilities for submodules to be used more freely and simular to the repo tool. A submodule can be added for many more reason and loosely coupled dependencies to the super repo which often gives the friction of handle the explicit commits and updates without the need for tracking the submodule sha1 by sha1.

Signed-off-by: Claus Schneider(Eficode) <claus.schneider@eficode.com>
---
 read-cache.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 32f32bdb4c..7b6d1b2914 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -48,6 +48,8 @@
 #include "csum-file.h"
 #include "promisor-remote.h"
 #include "hook.h"
+#include "submodule.h"
+#include "submodule-config.h"
 
 /* Mask for the name length in ce_flags in the on-disk index */
 
@@ -3956,7 +3958,7 @@ static void update_callback(struct diff_queue_struct *q,
 					}
 					if (pathspec_matches) {
 						if (data->include_ignored_submodules && data->include_ignored_submodules > 0) {
-							trace_printf("Add ignored=all submodule due to --include_ignored_submodules: %s\n", path);
+							trace_printf("Add submodule due to --include_ignored_submodules: %s\n", path);
 						} else {
 							printf(_("Skipping submodule due to ignore=all: %s"), path);
 							printf(_("Use --include_ignored_submodules, if you really want to add them.") );
@@ -3964,7 +3966,7 @@ static void update_callback(struct diff_queue_struct *q,
 						}
 					} else {
 						/* No explicit pathspec match -> skip silently (or with trace). */
-						trace_printf("pathspec does not match %s\n", path);
+						trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
 						continue;
 					}
 				}
@@ -3975,6 +3977,7 @@ static void update_callback(struct diff_queue_struct *q,
 				data->add_errors++;
 			}
 			break;
+		}
 		case DIFF_STATUS_DELETED:
 			if (data->flags & ADD_CACHE_IGNORE_REMOVAL)
 				break;
-- 
gitgitgadget
Previous: Claus Schneider(Eficode) via GitGitGadgetNext: Claus Schneider(Eficode) via GitGitGadget
Message 13 of 43 in “git-add : Respect submodule ignore=all and only add changes with --force”
  1. 0/5 git-add : Respect submodule ignore=all and only add changes with --forceClaus Schneider via GitGitGadget, Oct 18, 2025
  2. 1/5 read-cache: update add_files_to_cache to take param ignored_too(--force)Claus Schneider(Eficode) via GitGitGadget, Oct 18, 2025
  3. 2/5 read-cache: let read-cache respect submodule ignore=all and --forceClaus Schneider(Eficode) via GitGitGadget, Oct 18, 2025
  4. 3/5 tests: add new t2206-add-submodule-ignored.sh to test ignore=all scenarioClaus Schneider(Eficode) via GitGitGadget, Oct 18, 2025
  5. 4/5 tests: fix existing tests when add an ignore=all submoduleClaus Schneider(Eficode) via GitGitGadget, Oct 18, 2025
  6. 5/5 Documentation: update add --force and submodule ignore=all configClaus Schneider(Eficode) via GitGitGadget, Oct 18, 2025
  7. Phillip WoodOct 19, 2025
  8. Claus SchneiderOct 20, 2025
  9. Phillip WoodOct 24, 2025
  10. Claus SchneiderNov 13, 2025
  11. 0/5 git-add : Respect submodule ignore=all and only add changes with --forceClaus Schneider via GitGitGadget, Nov 13, 2025
  12. 1/5 read-cache: update add_files_to_cache take param include_ignored_submodulesClaus Schneider(Eficode) via GitGitGadget, Nov 13, 2025
  13. 2/5 read-cache: add/read-cache respect submodule ignore=allClaus Schneider(Eficode) via GitGitGadget, Nov 13, 2025
  14. 3/5 tests: add new t2206-add-submodule-ignored.sh to test ignore=all scenarioClaus Schneider(Eficode) via GitGitGadget, Nov 13, 2025
  15. 4/5 tests: fix existing tests when add an ignore=all submoduleClaus Schneider(Eficode) via GitGitGadget, Nov 13, 2025
  16. 5/5 Documentation: add --include_ignored_submodules + ignore=all configClaus Schneider(Eficode) via GitGitGadget, Nov 13, 2025
  17. Junio C HamanoNov 13, 2025
  18. Junio C HamanoNov 13, 2025
  19. Claus SchneiderNov 14, 2025
  20. 0/5 git-add: Skip submodules with ignore=all unless --force and explicit path usedClaus Schneider via GitGitGadget, Jan 14, 2026
  21. 1/5 read-cache: update add_files_to_cache take param ignored_tooClaus Schneider(Eficode) via GitGitGadget, Jan 14, 2026
  22. 2/5 read-cache: submodule add need --force given ignore=all configurationClaus Schneider(Eficode) via GitGitGadget, Jan 14, 2026
  23. 3/5 tests: t2206-add-submodule-ignored: ignore=all and add --force testsClaus Schneider(Eficode) via GitGitGadget, Jan 14, 2026
  24. 4/5 tests: fix existing tests when add an ignore=all submoduleClaus Schneider(Eficode) via GitGitGadget, Jan 14, 2026
  25. 5/5 Documentation: update add --force option + ignore=all configClaus Schneider(Eficode) via GitGitGadget, Jan 14, 2026
  26. Ben KnobleJan 14, 2026
  27. Kristoffer HaugsbakkJan 15, 2026
  28. Claus SchneiderJan 16, 2026
  29. Claus SchneiderJan 16, 2026
  30. Claus SchneiderFeb 5, 2026
  31. Junio C HamanoFeb 5, 2026
  32. 0/5 git-add: Skip submodules with ignore=all unless --force and explicit path usedClaus Schneider via GitGitGadget, Feb 6, 2026
  33. 1/5 read-cache: update add_files_to_cache take param ignored_tooClaus Schneider(Eficode) via GitGitGadget, Feb 6, 2026
  34. 2/5 read-cache: submodule add need --force given ignore=all configurationClaus Schneider(Eficode) via GitGitGadget, Feb 6, 2026
  35. 3/5 tests: t2206-add-submodule-ignored: ignore=all and add --force testsClaus Schneider(Eficode) via GitGitGadget, Feb 6, 2026
  36. 4/5 tests: fix existing tests when add an ignore=all submoduleClaus Schneider(Eficode) via GitGitGadget, Feb 6, 2026
  37. 5/5 Documentation: update add --force option + ignore=all configClaus Schneider(Eficode) via GitGitGadget, Feb 6, 2026
  38. Junio C HamanoFeb 9, 2026
  39. Junio C HamanoFeb 9, 2026
  40. Junio C HamanoFeb 20, 2026
  41. Kristoffer HaugsbakkMar 4, 2026
  42. Claus SchneiderMar 10, 2026
  43. Claus SchneiderMar 10, 2026

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.