diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-06-16 10:07:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-16 10:07:19 -0700 |
commit | 6d681f0a3e1fd10d4f51df3a90af30f4de299f89 (patch) | |
tree | 7a75a1e154a3e5077a100199f07260a040c245b6 /builtin | |
parent | 83a4904fad91c2de92140d344bee9912e89ee7d9 (diff) | |
parent | c215d3d2826c882feb819e5743287ec74d9ff693 (diff) | |
download | git-6d681f0a3e1fd10d4f51df3a90af30f4de299f89.tar.gz |
Merge branch 'jl/status-added-submodule-is-never-ignored'
submodule.*.ignore and diff.ignoresubmodules are used to ignore all
submodule changes in "diff" output, but it can be confusing to
apply these configuration values to status and commit.
This is a backward-incompatible change, but should be so in a good
way (aka bugfix).
* 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')
-rw-r--r-- | builtin/commit.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 99c2044635..5e2221c8e8 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -898,8 +898,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); |