[PATCH] clone: use child_process for recursive checkouts
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Dec 23, 2015, 11:30 UTC
- Message-ID
- <c21eb4a5d3a3a4886c45da0abe307fe1772e932e.1450869637.git.mhagger@alum.mit.edu>
- In-Reply-To
- <1449102921-7707-14-git-send-email-dturner@twopensource.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> --- David, I think if you insert this patch before your
13/16 refs: allow ref backend to be set for clone
, then the hunk in builtin/clone.c:checkout() of your patch becomes trivial:
if (refs_backend_type) argv_array_pushf(&cmd.args, "--refs-backend-type=%s", refs_backend_type);
builtin/clone.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c index caae43e..53c2834 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -95,10 +95,6 @@ static struct option builtin_clone_options[] = { OPT_END() }; -static const char *argv_submodule[] = { - "submodule", "update", "--init", "--recursive", NULL -}; - static const char *get_repo_path_1(struct strbuf *path, int *is_bundle) { static char *suffix[] = { "/.git", "", ".git/.git", ".git" }; @@ -724,8 +720,14 @@ 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 child_process cmd = CHILD_PROCESS_INIT; + + cmd.git_cmd = 1; + argv_array_pushl(&cmd.args, "submodule", "update", + "--init", "--recursive", NULL); + err = run_command(&cmd); + } return err; }
-- 2.6.4