path: root/diff-lib.c
diff options
authorJens Lehmann <>2010-06-08 16:31:51 (GMT)
committerJunio C Hamano <>2010-06-11 20:33:17 (GMT)
commitdd44d419d30afa52b863efa07aeec738c4531ea9 (patch)
tree4268bacc206a612a8d43e57da79ca5dd45dd3c73 /diff-lib.c
parentcf6aef803df93343e628e0c273a5d8f0d2f0fddb (diff)
Add optional parameters to the diff option "--ignore-submodules"
In some use cases it is not desirable that the diff family 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. 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. Signed-off-by: Jens Lehmann <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'diff-lib.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/diff-lib.c b/diff-lib.c
index c9f6e05..8b8978ae 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -70,6 +70,7 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
int changed = ce_match_stat(ce, st, ce_option);
if (S_ISGITLINK(ce->ce_mode)
&& (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES))) {
*dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));