Skip to content

Commit d180cc2

Browse files
committed
Merge branch 'ma/fetch-parallel-use-online-cpus'
"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
2 parents c5f7ef5 + c39952b commit d180cc2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

builtin/fetch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
21962196
if (dry_run)
21972197
write_fetch_head = 0;
21982198

2199+
if (!max_jobs)
2200+
max_jobs = online_cpus();
2201+
21992202
if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) &&
22002203
fetch_bundle_uri(the_repository, bundle_uri, NULL))
22012204
warning(_("failed to fetch bundles from '%s'"), bundle_uri);

t/t5514-fetch-multiple.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,9 @@ test_expect_success 'parallel' '
197197
test_i18ngrep "could not fetch .two.*128" err
198198
'
199199

200+
test_expect_success 'git fetch --multiple --jobs=0 picks a default' '
201+
(cd test &&
202+
git fetch --multiple --jobs=0)
203+
'
204+
200205
test_done

0 commit comments

Comments
 (0)