Skip to content

Commit

Permalink
Merge branch 'ma/fetch-parallel-use-online-cpus'
Browse files Browse the repository at this point in the history
"git fetch --jobs=0" used to hit a BUG(), which has been corrected
to use the available CPUs.

* ma/fetch-parallel-use-online-cpus:
  fetch: choose a sensible default with --jobs=0 again
  • Loading branch information
gitster committed Feb 25, 2023
2 parents c5f7ef5 + c39952b commit d180cc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builtin/fetch.c
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions t/t5514-fetch-multiple.sh
Expand Up @@ -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

0 comments on commit d180cc2

Please sign in to comment.