login
Header Space

 
 

[PATCH] Use run_command_v_opt_cd when checking out a submodule

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <skimo@...>
Cc: <git@...>, Junio C Hamano <junkio@...>
Date: Friday, May 18, 2007 - 6:48 pm

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 entry.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/entry.c b/entry.c
index 96a4a60..0316c74 100644
--- a/entry.c
+++ b/entry.c
@@ -166,7 +166,6 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 
 static int checkout_submodule(const char *path, struct cache_entry *ce, const struct checkout *state)
 {
-	static char cwd[PATH_MAX];
 	const char *gitdirenv;
 	const char *args[10];
 	int argc;
@@ -175,12 +174,6 @@ static int checkout_submodule(const char *path, struct cache_entry *ce, const st
 	if (!state->submodules)
 		return 0;
 
-	if (!getcwd(cwd, sizeof(cwd)) || cwd[0] != '/')
-		die("Unable to read current working directory");
-
-	if (chdir(path))
-		die("Cannot move to '%s'", path);
-
 	argc = 0;
 	args[argc++] = "checkout";
 	if (state->force)
@@ -190,12 +183,9 @@ static int checkout_submodule(const char *path, struct cache_entry *ce, const st
 
 	gitdirenv = getenv(GIT_DIR_ENVIRONMENT);
 	unsetenv(GIT_DIR_ENVIRONMENT);
-	err = run_command_v_opt(args, RUN_GIT_CMD);
+	err = run_command_v_opt_cd(args, RUN_GIT_CMD, path);
 	setenv(GIT_DIR_ENVIRONMENT, gitdirenv, 1);
 
-	if (chdir(cwd))
-		die("Cannot come back to cwd");
-
 	if (err)
 		return error("failed to run git-checkout in submodule '%s'", path);
 
-- 
1.5.2.rc3.83.gbbb0

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Second round of support for cloning submodules, Sven Verdoolaege, (Fri May 18, 3:34 pm)
[PATCH] Use run_command_v_opt_cd when checking out a submodule, Alex Riesen, (Fri May 18, 6:48 pm)
Re: [PATCH 09/16] entry.c: optionally checkout submodules, Sven Verdoolaege, (Fri May 18, 6:03 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Sven Verdoolaege, (Fri May 18, 6:08 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Junio C Hamano, (Fri May 18, 11:59 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Sven Verdoolaege, (Sat May 19, 9:05 am)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Shawn O. Pearce, (Sat May 19, 12:27 am)
[PATCH 01/16] Add dump-config, , (Fri May 18, 3:24 pm)
speck-geostationary