Re: [PATCH] doc: fetch: document `--jobs=0` behavior
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 2, 2026, 19:33 UTC
- Message-ID
- <xmqqo6l6yqkp.fsf@gitster.g>
- In-Reply-To
- <25715312-b6a0-0cdd-d62c-3a4a840b0244@gmx.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 21 quoted lines
>> Dscho, do you remember by chance why you decided to not be more specific >> here? > > Unfortunately not. > > So I went on reconstructing the lay of the land back when d54dea77dba > (fetch: let --jobs=<n> parallelize --multiple, too, 2019-10-05) landed. > With that commit, the `max_children` variable (which `--jobs=0` would set > to 0) would be passed via `fetch_multiple()` [*1*] or > `fetch_populated_submodules()` [*2*] to `run_processes_parallel_tr2()`, > which would pass it through to `run_processes_parallel()` as the first > parameter (called `n`) [*3*]. That function would pass that variable to > `pp_init()` first thing [*4*], which would fall back to `online_cpus()` if > it saw a value smaller than 1 [*5*]. > > So: The "reasonable default" is the number of CPUs, or more correctly, of > CPU cores. It does seem, though, that that was considered common knowledge > at the time, given e.g. v2.40.0's release notes saying [*6*]: > > "git fetch --jobs=0" used to hit a BUG(), which has been corrected > to use the available CPUs.
The belief that "available CPU cores is a reasonable default" turns out to be older than that.
Back in the days we didn't thread iterations of the same topic properly, so visiting the discussion thread and trying to find older iterations of the same topic was a nightmare, but I think I found where the phrasing came from:
https://lore.kernel.org/git/1446074504-6014-6-git-send-email-sbeller@google.com/
This is a step in the second iteration of fetching submodules in parallel topic from 28 Oct 2015, where "some reasonable default" appears. I think it was done in response to a review comment on its earlier iteration which was:
https://lore.kernel.org/git/xmqqio5sni1j.fsf@gitster.mtv.corp.google.com/
Later the work resulted in a028a193 (fetching submodules: respect `submodule.fetchJobs` config option, 2016-02-29).
https://lore.kernel.org/git/1456798040-30129-4-git-send-email-sbeller@google.com/
The variable fetch.parallel did not exist until d54dea77 (fetch: let --jobs=<n> parallelize --multiple, too, 2019-10-05) copied the famous "some reasonable default" phrasing to its documentation.