Git development
 help / color / mirror / Atom feed
From: Abhishek Agarwal <agab0323@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Patrick Steinhardt <ps@pks.im>,
	Jacob Keller <jacob.keller@gmail.com>,
	Adrian Ratiu <adrian.ratiu@collabora.com>
Subject: [PATCH 0/2] clone, fetch: reject a negative --jobs
Date: Wed,  2 Dec 2026 22:43:26 +0530	[thread overview]
Message-ID: <20261202171328.805150-1-agab0323@gmail.com> (raw)

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


             reply	other threads:[~2026-12-02 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 17:13 Abhishek Agarwal [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202171328.805150-1-agab0323@gmail.com \
    --to=agab0323@gmail.com \
    --cc=adrian.ratiu@collabora.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox