Subject: Re: [PATCH] doc: fetch: document `--jobs=0` behavior

From: Junio C Hamano <[email-masked]>
Date: Mon, 02 Mar 2026 11:33:10 -0800

Johannes Schindelin <[email-masked]> writes:

>> 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/[email-masked]/

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/[email-masked]/

Later the work resulted in a028a193 (fetching submodules: respect
`submodule.fetchJobs` config option, 2016-02-29).

https://lore.kernel.org/git/[email-masked]/

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.