Merge branch 'jl/status-added-submodule-is-never-ignored' into maint
[gitweb.git] / wt-status.c
index ec7344e50834f18821692d7e38f634778d632080..86fec8986f3c22911a85a042704d4150ccb6a134 100644 (file)
@@ -519,9 +519,19 @@ static void wt_status_collect_changes_index(struct wt_status *s)
        opt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;
        setup_revisions(0, NULL, &rev, &opt);
 
+       DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
        if (s->ignore_submodule_arg) {
-               DIFF_OPT_SET(&rev.diffopt, OVERRIDE_SUBMODULE_CONFIG);
                handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);
+       } else {
+               /*
+                * Unless the user did explicitly request a submodule ignore
+                * mode by passing a command line option we do not ignore any
+                * changed submodule SHA-1s when comparing index and HEAD, no
+                * matter what is configured. Otherwise the user won't be
+                * shown any submodules she manually added (and which are
+                * staged to be committed), which would be really confusing.
+                */
+               handle_ignore_submodules_arg(&rev.diffopt, "dirty");
        }
 
        rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;