diff --git a/builtin/fetch.c b/builtin/fetch.c index a21ce89312..a09606b472 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -2196,6 +2196,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) if (dry_run) write_fetch_head = 0; + if (!max_jobs) + max_jobs = online_cpus(); + if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) && fetch_bundle_uri(the_repository, bundle_uri, NULL)) warning(_("failed to fetch bundles from '%s'"), bundle_uri); diff --git a/t/t5514-fetch-multiple.sh b/t/t5514-fetch-multiple.sh index 511ba3bd45..54f422ced3 100755 --- a/t/t5514-fetch-multiple.sh +++ b/t/t5514-fetch-multiple.sh @@ -197,4 +197,9 @@ test_expect_success 'parallel' ' test_i18ngrep "could not fetch .two.*128" err ' +test_expect_success 'git fetch --multiple --jobs=0 picks a default' ' + (cd test && + git fetch --multiple --jobs=0) +' + test_done