]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff-lib.c
Merge branch 'jc/maint-diff-q-filter' into maint
[thirdparty/git.git] / diff-lib.c
index 8b8978ae6d1b4d947952b7fe9ec9cea013aaa8c3..f8e33256ebe7ecd6ebf69669d9bfe50488c01fa1 100644 (file)
@@ -68,11 +68,16 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
                                      unsigned ce_option, unsigned *dirty_submodule)
 {
        int changed = ce_match_stat(ce, st, ce_option);
-       if (S_ISGITLINK(ce->ce_mode)
-           && !DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES)
-           && !DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
-           && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES))) {
-               *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
+       if (S_ISGITLINK(ce->ce_mode)) {
+               unsigned orig_flags = diffopt->flags;
+               if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
+                       set_diffopt_flags_from_submodule_config(diffopt, ce->name);
+               if (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))
+                       changed = 0;
+               else if (!DIFF_OPT_TST(diffopt, IGNORE_DIRTY_SUBMODULES)
+                   && (!changed || DIFF_OPT_TST(diffopt, DIRTY_SUBMODULES)))
+                       *dirty_submodule = is_submodule_modified(ce->name, DIFF_OPT_TST(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES));
+               diffopt->flags = orig_flags;
        }
        return changed;
 }
@@ -98,7 +103,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                unsigned dirty_submodule = 0;
 
                if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
-                       DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
+                   !revs->diffopt.filter &&
+                   DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
                        break;
 
                if (!ce_path_match(ce, revs->prune_data))