summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-03-01 02:07:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-01 19:57:20 (GMT)
commit2335b870fa7942d9ca9e73e96e35171fda741376 (patch)
treef76c7f7b8fcd2d4bcac7ec1f57f53eb079c2b1c0 /builtin/submodule--helper.c
parentcdc04b65b4bc8094e082ac65a7dce75a7a990163 (diff)
downloadgit-2335b870fa7942d9ca9e73e96e35171fda741376.zip
git-2335b870fa7942d9ca9e73e96e35171fda741376.tar.gz
git-2335b870fa7942d9ca9e73e96e35171fda741376.tar.bz2
submodule update: expose parallelism to the user
Expose possible parallelism either via the "--jobs" CLI parameter or the "submodule.fetchJobs" setting. By having the variable initialized to -1, we make sure 0 can be passed into the parallel processing machine, which will then pick as many parallel workers as there are CPUs. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 9e8109e..a484945 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -430,6 +430,7 @@ static int update_clone_task_finished(int result,
static int update_clone(int argc, const char **argv, const char *prefix)
{
const char *update = NULL;
+ int max_jobs = -1;
struct string_list_item *item;
struct pathspec pathspec;
struct submodule_update_clone suc = SUBMODULE_UPDATE_CLONE_INIT;
@@ -450,6 +451,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
OPT_STRING(0, "depth", &suc.depth, "<depth>",
N_("Create a shallow clone truncated to the "
"specified number of revisions")),
+ OPT_INTEGER('j', "jobs", &max_jobs,
+ N_("parallel jobs")),
OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
OPT_END()
};
@@ -477,7 +480,10 @@ static int update_clone(int argc, const char **argv, const char *prefix)
gitmodules_config();
git_config(submodule_config, NULL);
- run_processes_parallel(1,
+ if (max_jobs < 0)
+ max_jobs = parallel_submodules();
+
+ run_processes_parallel(max_jobs,
update_clone_get_next_task,
update_clone_start_failure,
update_clone_task_finished,