From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, jrnieder@gmail.com, Jens.Lehmann@web.de
Subject: Re: [PATCHv8 6/9] fetching submodules: respect `submodule.fetchJobs` config option
Date: Thu, 04 Feb 2016 19:29:48 -0800 [thread overview]
Message-ID: <xmqqa8nfeswj.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1454623776-3347-7-git-send-email-sbeller@google.com> (Stefan Beller's message of "Thu, 4 Feb 2016 14:09:33 -0800")
Stefan Beller <sbeller@google.com> writes:
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index 586840d..5aa1c2d 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -37,7 +37,7 @@ static int prune = -1; /* unspecified */
> static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity;
> static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
> static int tags = TAGS_DEFAULT, unshallow, update_shallow;
> -static int max_children = 1;
> +static int max_children = -1;
This makes sense as you would later be doing "If left unspecified,
i.e. -1, then fall back to blah" ...
g> diff --git a/submodule-config.c b/submodule-config.c
> index 2841c5e..339b59d 100644
> --- a/submodule-config.c
> +++ b/submodule-config.c
> @@ -32,6 +32,7 @@ enum lookup_type {
>
> static struct submodule_cache cache;
> static int is_cache_init;
> +static unsigned long parallel_jobs = -1;
... but I do not think this does. For one thing, you would not be
doing "If parallel_jobs < -1, then that is unspecified yet" for the
unsigned long variable, and for another, I do not think you would be
behaving differently for the first time (i.e. "unspecified yet" case).
I think you want to initialize this to 1, if your "not configured at
all" default is supposed to be 1.
> @@ -233,6 +234,13 @@ static int parse_generic_submodule_config(const char *key,
> const char *value,
> struct parse_config_parameter *me)
> {
> + if (!strcmp(key, "fetchjobs")) {
> + if (!git_parse_ulong(value, ¶llel_jobs)) {
> + warning(_("Error parsing submodule.fetchJobs; Defaulting to 1."));
> + parallel_jobs = 1;
Hmph, this is not a die() because...? Not a rhetorical question.
> +unsigned long config_parallel_submodules(void)
> +{
> + return parallel_jobs;
> +}
It is not a crime to make this return "int", as the code that
eventually uses it will assign it to a variable that will be
passed to run_processes_parallel() that takes an "int".
In fact, returning "int" would be preferrable. You are causing
truncation somewhere in the callchain anyway. If the truncation
bothers you, this function or immediately after calling
git_parse_ulong() would be a good place to do a range check. The
variable parallel_jobs has to stay "unsigned long" in any case as
you are calling git_parse_ulong().
> diff --git a/submodule.c b/submodule.c
> index b83939c..eb7d54b 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -751,6 +751,11 @@ int fetch_populated_submodules(const struct argv_array *options,
> argv_array_push(&spf.args, "--recurse-submodules-default");
> /* default value, "--submodule-prefix" and its value are added later */
>
> + if (max_parallel_jobs < 0)
> + max_parallel_jobs = config_parallel_submodules();
> + if (max_parallel_jobs < 0)
> + max_parallel_jobs = 1;
> +
> calculate_changed_submodule_paths();
> run_processes_parallel(max_parallel_jobs,
> get_next_submodule,
next prev parent reply other threads:[~2016-02-05 3:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 22:09 [PATCHv8 0/9] Expose submodule parallelism to the user Stefan Beller
2016-02-04 22:09 ` [PATCHv8 1/9] submodule-config: keep update strategy around Stefan Beller
2016-02-05 0:59 ` Jonathan Nieder
2016-02-05 20:25 ` Stefan Beller
2016-02-05 20:33 ` Jonathan Nieder
2016-02-05 20:36 ` Stefan Beller
2016-02-04 22:09 ` [PATCHv8 2/9] submodule-config: drop check against NULL Stefan Beller
2016-02-05 1:05 ` Jonathan Nieder
2016-02-04 22:09 ` [PATCHv8 3/9] submodule-config: remove name_and_item_from_var Stefan Beller
2016-02-06 0:46 ` Jonathan Nieder
2016-02-06 1:21 ` Stefan Beller
2016-02-04 22:09 ` [PATCHv8 4/9] submodule-config: slightly simplify lookup_or_create_by_name Stefan Beller
2016-02-06 0:48 ` Jonathan Nieder
2016-02-04 22:09 ` [PATCHv8 5/9] submodule-config: introduce parse_generic_submodule_config Stefan Beller
2016-02-06 1:23 ` Jonathan Nieder
2016-02-06 1:36 ` Stefan Beller
2016-02-04 22:09 ` [PATCHv8 6/9] fetching submodules: respect `submodule.fetchJobs` config option Stefan Beller
2016-02-05 3:29 ` Junio C Hamano [this message]
2016-02-05 18:50 ` Stefan Beller
2016-02-05 19:59 ` Junio C Hamano
2016-02-04 22:09 ` [PATCHv8 7/9] git submodule update: have a dedicated helper for cloning Stefan Beller
2016-02-04 22:09 ` [PATCHv8 8/9] submodule update: expose parallelism to the user Stefan Beller
2016-02-04 22:09 ` [PATCHv8 9/9] clone: allow an explicit argument for parallel submodule clones Stefan Beller
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=xmqqa8nfeswj.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=sbeller@google.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.