summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-06-25 11:50:03 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-06-25 11:50:03 -0700
commit287a8701f6fe263696e9c74a3a2020f4cfbf4239 (patch)
tree865da60d812e652adc675edf32ee2fda851d823d /builtin/commit.c
parentMerge branch 'ym/fix-opportunistic-index-update-race' into maint (diff)
parentcommit -m: commit staged submodules regardless of ignore config (diff)
downloadtgif-287a8701f6fe263696e9c74a3a2020f4cfbf4239.tar.xz
Merge branch 'jl/status-added-submodule-is-never-ignored' into maint
"git status" (and "git commit") behaved as if changes in a modified submodule are not there if submodule.*.ignore configuration is set, which was misleading. The configuration is only to unclutter diff output during the course of development, and should not to hide changes in the "status" output to cause the users forget to commit them. * jl/status-added-submodule-is-never-ignored: commit -m: commit staged submodules regardless of ignore config status/commit: show staged submodules regardless of ignore config
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 65c069d2cb..12afc42d19 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -832,8 +832,22 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (get_sha1(parent, sha1))
commitable = !!active_nr;
- else
- commitable = index_differs_from(parent, 0);
+ 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 parent, no matter what is
+ * configured. Otherwise we won't commit any
+ * submodules which were manually staged, which would
+ * be really confusing.
+ */
+ int diff_flags = DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
+ if (ignore_submodule_arg &&
+ !strcmp(ignore_submodule_arg, "all"))
+ diff_flags |= DIFF_OPT_IGNORE_SUBMODULES;
+ commitable = index_differs_from(parent, diff_flags);
+ }
}
strbuf_release(&committer_ident);