From: Patrick Steinhardt <ps@pks.im>
To: Abhishek Agarwal <agab0323@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jacob Keller <jacob.keller@gmail.com>,
Adrian Ratiu <adrian.ratiu@collabora.com>
Subject: Re: [PATCH 2/2] fetch: reject a negative --jobs
Date: Thu, 3 Dec 2026 10:56:08 +0100 [thread overview]
Message-ID: <axE8uP_wHC4p70YC@pks.im> (raw)
In-Reply-To: <20261202171328.805150-3-agab0323@gmail.com>
On Wed, Dec 02, 2026 at 10:43:28PM +0530, Abhishek Agarwal wrote:
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index 533fdfe7d8..12140f6a87 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -207,6 +207,19 @@ static int parse_refmap_arg(const struct option *opt, const char *arg, int unset
> return 0;
> }
>
> +static int parse_jobs_cb(const struct option *opt, const char *arg, int unset)
> +{
> + int *jobs = opt->value;
> +
> + if (unset)
> + *jobs = 0;
> + else if (!git_parse_int(arg, jobs))
> + return error(_("invalid value for '%s': '%s'"), "--jobs", arg);
> + else if (*jobs < 0)
> + return error(_("'%s' cannot be negative"), "--jobs");
> + return 0;
> +}
> +
> static void unlock_pack(unsigned int flags)
> {
> if (gtransport)
> @@ -2555,8 +2568,9 @@ int cmd_fetch(int argc,
> N_("fetch all tags and associated objects"), TAGS_SET),
> OPT_SET_INT('n', NULL, &tags,
> N_("do not fetch all tags (--no-tags)"), TAGS_UNSET),
> - OPT_INTEGER('j', "jobs", &max_jobs,
> - N_("number of submodules fetched in parallel")),
> + OPT_CALLBACK('j', "jobs", &max_jobs, N_("n"),
> + N_("number of submodules fetched in parallel"),
> + parse_jobs_cb),
> OPT_BOOL(0, "prefetch", &prefetch,
> N_("modify the refspec to place all refs within refs/prefetch/")),
> OPT_BOOL('p', "prune", &prune,
And this is essentially the equivalent change, just for git-fetch(1).
The same suggestion as for git-clone(1) applies here of course.
Overall, these changes look good to me though, thanks!
Patrick
prev parent reply other threads:[~2026-12-03 9:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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-03 9:56 ` Patrick Steinhardt
2026-12-02 17:13 ` [PATCH 2/2] fetch: reject a negative --jobs Abhishek Agarwal
2026-12-03 9:56 ` Patrick Steinhardt [this message]
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=axE8uP_wHC4p70YC@pks.im \
--to=ps@pks.im \
--cc=adrian.ratiu@collabora.com \
--cc=agab0323@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.