path: root/submodule.c
diff options
authorJens Lehmann <>2010-06-25 14:56:47 (GMT)
committerJunio C Hamano <>2010-06-25 18:30:25 (GMT)
commit46a958b3daa1da336683ec82d7f321d0f51b39c8 (patch)
treecc5b3a42bdd09d3f86e6f0b5f34d1f143729b35c /submodule.c
parent18076502cb282482f3cd75d766e1478cc3fccc29 (diff)
Add the option "--ignore-submodules" to "git status"
In some use cases it is not desirable that "git status" considers submodules that only contain untracked content as dirty. This may happen e.g. when the submodule is not under the developers control and not all build generated files have been added to .gitignore by the upstream developers. Using the "untracked" parameter for the "--ignore-submodules" option disables checking for untracked content and lets git diff report them as changed only when they have new commits or modified content. Sometimes it is not wanted to have submodules show up as changed when they just contain changes to their work tree (this was the behavior before 1.7.0). An example for that are scripts which just want to check for submodule commits while ignoring any changes to the work tree. Also users having large submodules known not to change might want to use this option, as the - sometimes substantial - time it takes to scan the submodule work tree(s) is saved when using the "dirty" parameter. And if you want to ignore any changes to submodules, you can now do that by using this option without parameters or with "all" (when the config option status.submodulesummary is set, using "all" will also suppress the output of the submodule summary). A new function handle_ignore_submodules_arg() is introduced to parse this option new to "git status" in a single location, as "git diff" already knew it. Signed-off-by: Jens Lehmann <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'submodule.c')
1 files changed, 13 insertions, 0 deletions
diff --git a/submodule.c b/submodule.c
index 676d48f..61cb6e2 100644
--- a/submodule.c
+++ b/submodule.c
@@ -46,6 +46,19 @@ done:
return ret;
+void handle_ignore_submodules_arg(struct diff_options *diffopt,
+ const char *arg)
+ if (!strcmp(arg, "all"))
+ else if (!strcmp(arg, "untracked"))
+ else if (!strcmp(arg, "dirty"))
+ else
+ die("bad --ignore-submodules argument: %s", arg);
void show_submodule_summary(FILE *f, const char *path,
unsigned char one[20], unsigned char two[20],
unsigned dirty_submodule,