summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-07-25 21:39:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-02 21:35:08 (GMT)
commit5556808690ea245708fb80383be5c1afee2fb3eb (patch)
tree48b7ef9c30f3426a1e68b44346d425ec1914eaa1 /builtin/add.c
parent9ef23f91fc22be9327288c8dbb10646bb0bf4340 (diff)
downloadgit-5556808690ea245708fb80383be5c1afee2fb3eb.zip
git-5556808690ea245708fb80383be5c1afee2fb3eb.tar.gz
git-5556808690ea245708fb80383be5c1afee2fb3eb.tar.bz2
add, reset: ensure submodules can be added or reset
Commit aee9c7d65 (Submodules: Add the new "ignore" config option for diff and status) introduced the ignore configuration option for submodules so that configured submodules could be omitted from the status and diff commands. Because this flag is respected in the diff machinery it has the unintended consequence of potentially prohibiting users from adding or resetting a submodule, even when a path to the submodule is explicitly given. Ensure that submodules can be added or set, even if they are configured to be ignored, by setting the `DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG` diff flag. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index e888fb8..6f27151 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -116,6 +116,7 @@ int add_files_to_cache(const char *prefix,
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
rev.diffopt.format_callback_data = &data;
+ rev.diffopt.flags |= DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
return !!data.add_errors;