fetch: don't overlay config with submodule-config
authorBrandon Williams <bmwill@google.com>
Thu, 3 Aug 2017 18:19:51 +0000 (11:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 3 Aug 2017 20:11:01 +0000 (13:11 -0700)
Don't rely on overlaying the repository's config on top of the
submodule-config, instead query the repository's config directly for the
fetch_recurse field.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
submodule.c
index d84c26391c59cddb57d278b81f69ddf72af01fa8..3fe99073d3ac00a0c364d7a4e266c4b11d94dcd8 100644 (file)
@@ -1362,7 +1362,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 
        if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
                gitmodules_config();
-               git_config(submodule_config, NULL);
        }
 
        if (all) {
index 8a9b964ce8565b7b7d5bcaa668a54ba4c852514d..59e3d0828fcfa957bdf5a50c782e50c783f6e47b 100644 (file)
@@ -1194,14 +1194,24 @@ static int get_next_submodule(struct child_process *cp,
 
                default_argv = "yes";
                if (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) {
-                       if (submodule &&
-                           submodule->fetch_recurse !=
-                                               RECURSE_SUBMODULES_NONE) {
-                               if (submodule->fetch_recurse ==
-                                               RECURSE_SUBMODULES_OFF)
+                       int fetch_recurse = RECURSE_SUBMODULES_NONE;
+
+                       if (submodule) {
+                               char *key;
+                               const char *value;
+
+                               fetch_recurse = submodule->fetch_recurse;
+                               key = xstrfmt("submodule.%s.fetchRecurseSubmodules", submodule->name);
+                               if (!repo_config_get_string_const(the_repository, key, &value)) {
+                                       fetch_recurse = parse_fetch_recurse_submodules_arg(key, value);
+                               }
+                               free(key);
+                       }
+
+                       if (fetch_recurse != RECURSE_SUBMODULES_NONE) {
+                               if (fetch_recurse == RECURSE_SUBMODULES_OFF)
                                        continue;
-                               if (submodule->fetch_recurse ==
-                                               RECURSE_SUBMODULES_ON_DEMAND) {
+                               if (fetch_recurse == RECURSE_SUBMODULES_ON_DEMAND) {
                                        if (!unsorted_string_list_lookup(&changed_submodule_paths, ce->name))
                                                continue;
                                        default_argv = "on-demand";