fetch: don't overlay config with submodule-config
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>
Brandon Williams committed
Aug 3, 2017 at 11:19 UTC
492c6c46da7847370d8ce0e6d369ae62215b6f8e
2 files changed
+17
-8
builtin/fetch.c
-1
@@ -1362,7 +1362,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
1362
1363
if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
1364
gitmodules_config();
1365
- git_config(submodule_config, NULL);
1365
}
1366
1367
if (all) {
submodule.c
+17
-7
@@ -1194,14 +1194,24 @@ static int get_next_submodule(struct child_process *cp,
1194
1195
default_argv = "yes";
1196
if (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) {
1197
- if (submodule &&
1198
- submodule->fetch_recurse !=
1199
- RECURSE_SUBMODULES_NONE) {
1200
- if (submodule->fetch_recurse ==
1201
- RECURSE_SUBMODULES_OFF)
1197
+ int fetch_recurse = RECURSE_SUBMODULES_NONE;
1198
+
1199
+ if (submodule) {
1200
+ char *key;
1201
+ const char *value;
1202
+
1203
+ fetch_recurse = submodule->fetch_recurse;
1204
+ key = xstrfmt("submodule.%s.fetchRecurseSubmodules", submodule->name);
1205
+ if (!repo_config_get_string_const(the_repository, key, &value)) {
1206
+ fetch_recurse = parse_fetch_recurse_submodules_arg(key, value);
1207
+ }
1208
+ free(key);
1209
+ }
1210
+
1211
+ if (fetch_recurse != RECURSE_SUBMODULES_NONE) {
1212
+ if (fetch_recurse == RECURSE_SUBMODULES_OFF)
1213
continue;
1203
- if (submodule->fetch_recurse ==
1204
- RECURSE_SUBMODULES_ON_DEMAND) {
1214
+ if (fetch_recurse == RECURSE_SUBMODULES_ON_DEMAND) {
1215
if (!unsorted_string_list_lookup(&changed_submodule_paths, ce->name))
1216
continue;
1217
default_argv = "on-demand";