[PATCH v2 17/21] clone: use child_process for recursive checkouts
From: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
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.4.2.749.g730654d-twtrsrc