Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] clone, fetch: reject a negative --jobs
@ 2026-12-02 17:13 Abhishek Agarwal
  2026-12-02 17:13 ` [PATCH 1/2] clone: reject a negative --jobs before cloning Abhishek Agarwal
  2026-12-02 17:13 ` [PATCH 2/2] fetch: reject a negative --jobs Abhishek Agarwal
  0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Agarwal @ 2026-12-02 17:13 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Jacob Keller, Adrian Ratiu

In the review of aa/submodule-update-jobs [1], Junio pointed out that
"git clone --recurse-submodules --jobs=-1" is ignored without a word,
because clone uses -1 to mean "not given" and does not pass it on,
while "--jobs=-2" is passed on and only rejected by "submodule update"
after the clone is done. He wondered if "fetch" has a similar issue.
It does: "git fetch" and "git pull" treat any negative "--jobs" as if
the option was not given.

These two patches make both commands reject a negative value while
the command line is parsed, with the same message "submodule update"
now gives. The series is built on top of aa/submodule-update-jobs,
because the first patch adds its test next to the tests from that
topic.

Two things I was not sure about:

 - Both patches add the same small callback. I kept a copy in each
   command so that the two stay independent, but I can move it to
   parse-options-cb.c if that is preferred.

 - "git hook run -j-1" uses -1 to mean "all CPUs" (495b7d54dc). I did
   not do that here, because the configuration variables clone and
   fetch fall back to (submodule.fetchJobs and fetch.parallel) reject
   negative values and use 0 for "all CPUs", and so does "submodule
   update --jobs" after the topic above.

[1] https://lore.kernel.org/git/xmqqtsl4zlyl.fsf@gitster.g/

Abhishek Agarwal (2):
  clone: reject a negative --jobs before cloning
  fetch: reject a negative --jobs

 builtin/clone.c             | 18 ++++++++++++++++--
 builtin/fetch.c             | 18 ++++++++++++++++--
 t/t5514-fetch-multiple.sh   |  8 ++++++++
 t/t7406-submodule-update.sh | 10 ++++++++++
 4 files changed, 50 insertions(+), 4 deletions(-)


base-commit: 5d6ad3960bf5d6e577b706d8c642429b504b065d
-- 
2.56.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-02 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 17:13 [PATCH 0/2] clone, fetch: reject a negative --jobs Abhishek Agarwal
2026-12-02 17:13 ` [PATCH 1/2] clone: reject a negative --jobs before cloning Abhishek Agarwal
2026-12-02 17:13 ` [PATCH 2/2] fetch: reject a negative --jobs Abhishek Agarwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox