Thread (54 messages) 54 messages, 10 authors, 2016-06-15
STALE3758d

[PATCH] clone: use child_process for recursive checkouts

From: Michael Haggerty <hidden>
Date: 2016-06-15 23:07:33
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Michael Haggerty <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help