From: Eric Sunshine Date: Sun, 01 Nov 2015 08:58:38 GMT Subject: Re: [PATCHv2 8/8] clone: allow an explicit argument for parallel submodule clones Message-ID: In-Reply-To: <1446074504-6014-9-git-send-email-sbeller@google.com> On Wed, Oct 28, 2015 at 7:21 PM, Stefan Beller wrote: > 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 > --- > @@ -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); > + } > + > + err = run_command_v_opt(args.argv, RUN_GIT_CMD); > + argv_array_clear(&args); > + } > > return err; > }