summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-10-12 21:02:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-10-12 21:12:41 (GMT)
commit51243f9f0f6a932ea579fd6f8014b348f8c2a523 (patch)
tree336ac80d78c311a29fb9450f1c72899d2fdd528d /builtin/fetch.c
parent6a48b428b4c36c4f96ccb64a189658887c78be3f (diff)
downloadgit-51243f9f0f6a932ea579fd6f8014b348f8c2a523.zip
git-51243f9f0f6a932ea579fd6f8014b348f8c2a523.tar.gz
git-51243f9f0f6a932ea579fd6f8014b348f8c2a523.tar.bz2
run-command API: don't fall back on online_cpus()
When a "jobs = 0" is passed let's BUG() out rather than fall back on online_cpus(). The default behavior was added when this API was implemented in c553c72eed6 (run-command: add an asynchronous parallel child processor, 2015-12-15). Most of our code in-tree that scales up to "online_cpus()" by default calls that function by itself. Keeping this default behavior just for the sake of two callers means that we'd need to maintain this one spot where we're second-guessing the config passed down into pp_init(). The preceding commit has an overview of the API callers that passed "jobs = 0". There were only two of them (actually three, but they resolved to these two config parsing codepaths). The "fetch.parallel" caller already had a test for the "fetch.parallel=0" case added in 0353c688189 (fetch: do not run a redundant fetch from submodule, 2022-05-16), but there was no such test for "submodule.fetchJobs". Let's add one here. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 78043fb..82f1da1 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -122,6 +122,8 @@ static int git_fetch_config(const char *k, const char *v, void *cb)
fetch_parallel_config = git_config_int(k, v);
if (fetch_parallel_config < 0)
die(_("fetch.parallel cannot be negative"));
+ if (!fetch_parallel_config)
+ fetch_parallel_config = online_cpus();
return 0;
}