Re: [PATCHv2 8/8] clone: allow an explicit argument for parallel submodule clones
On Wed, Oct 28, 2015 at 7:21 PM, Stefan Beller <sbeller@google.com> wrote:
Show 20 quoted lines
> Just pass it along to "git submodule update", which may pick reasonable
> defaults if you don't specify an explicit number.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> @@ -724,8 +723,20 @@ static int checkout(void)
> err |= run_hook_le(NULL, "post-checkout", sha1_to_hex(null_sha1),
> sha1_to_hex(sha1), "1", NULL);
>
> - if (!err && option_recursive)
> - err = run_command_v_opt(argv_submodule, RUN_GIT_CMD);
> + if (!err && option_recursive) {
> + struct argv_array args = ARGV_ARRAY_INIT;
> + argv_array_pushl(&args, "submodule", "update", "--init", "--recursive", NULL);
> +
> + if (max_jobs != -1) {
> + struct strbuf sb = STRBUF_INIT;
> + strbuf_addf(&sb, "--jobs=%d", max_jobs);
> + argv_array_push(&args, sb.buf);
> + strbuf_release(&sb);The above four lines can be collapsed to:
argv_array_pushf(&args, "--jobs=%d", max_jobs);
Show 8 quoted lines
> + }
> +
> + err = run_command_v_opt(args.argv, RUN_GIT_CMD);
> + argv_array_clear(&args);
> + }
>
> return err;
> }