# Patches make clone and fetch reject negative --jobs instead of ignoring it

_Follow-up to a review comment by Junio C Hamano: "--jobs=-1" was silently dropped by clone, and fetch and pull treated any negative value as not given._

Section: Patches. Edition of 2026-12-03. Written by an AI editor from the thread "[PATCH 0/2] clone, fetch: reject a negative --jobs" (5 messages): https://gitlist.dev/t/66973

Abhishek Agarwal says that during review of aa/submodule-update-jobs, Junio C Hamano pointed out that `git clone --recurse-submodules --jobs=-1` is ignored without a word. Clone uses -1 to mean the option was not given and does not pass it on, while --jobs=-2 is passed on and only rejected by "submodule update" after the clone is complete. Junio wondered whether fetch had a similar issue.

Agarwal found that it does. git fetch starts max_jobs at -1 to mean not given, and both places that use it, fetching from several remotes and fetching submodules, replace any negative value with fetch.parallel, submodule.fetchJobs, or one job. So --jobs=-1 and --jobs=-5 are accepted silently, even though both configuration variables reject negative values. git pull passes --jobs on to fetch and behaves the same way.

The first patch parses clone's option with a callback that rejects a negative value, as `git submodule update --jobs` and submodule.fetchJobs already do. The error then comes before anything is cloned, rather than after the whole clone, which would leave submodules unchecked-out. The second patch reuses the same callback for fetch. "--no-jobs" still means the same as "--jobs=0".

The series depends on aa/submodule-update-jobs because the first patch adds its test next to that topic's tests. No replies are visible yet.
