submodule-config: add helper to get 'update-clone' config from .gitmodules
[git/git.git] / submodule-config.c
index f44d6a7..9a2b13d 100644 (file)
@@ -716,3 +716,17 @@ void fetch_config_from_gitmodules(int *max_children, int *recurse_submodules)
        };
        config_from_gitmodules(gitmodules_fetch_config, &config);
 }
+
+static int gitmodules_update_clone_config(const char *var, const char *value,
+                                         void *cb)
+{
+       int *max_jobs = cb;
+       if (!strcmp(var, "submodule.fetchjobs"))
+               *max_jobs = parse_submodule_fetchjobs(var, value);
+       return 0;
+}
+
+void update_clone_config_from_gitmodules(int *max_jobs)
+{
+       config_from_gitmodules(gitmodules_update_clone_config, &max_jobs);
+}