git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] run-command: optionally clear git environment
@ 2007-05-25 21:07 skimo
  2007-05-25 21:07 ` [PATCH 2/3] entry.c: checkout available submodules skimo
  2007-05-25 21:07 ` [PATCH 3/3] test for simple submodule checkout support skimo
  0 siblings, 2 replies; 7+ messages in thread
From: skimo @ 2007-05-25 21:07 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Martin Waitz, Alex Riesen

From: Sven Verdoolaege <skimo@kotnet.org>

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
---
 run-command.c |    6 ++++++
 run-command.h |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/run-command.c b/run-command.c
index 7e779d3..5c47f45 100644
--- a/run-command.c
+++ b/run-command.c
@@ -2,6 +2,10 @@
 #include "run-command.h"
 #include "exec_cmd.h"
 
+static const char* git_env_list[] = { ALTERNATE_DB_ENVIRONMENT, DB_ENVIRONMENT,
+			CONFIG_ENVIRONMENT, GIT_DIR_ENVIRONMENT,
+			GRAFT_ENVIRONMENT, INDEX_ENVIRONMENT, NULL };
+
 static inline void close_pair(int fd[2])
 {
 	close(fd[0]);
@@ -153,6 +157,8 @@ static void prepare_run_command_v_opt(struct child_process *cmd,
 	cmd->no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0;
 	cmd->git_cmd = opt & RUN_GIT_CMD ? 1 : 0;
 	cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
+	if (opt & RUN_COMMAND_CLEAR_GIT_ENV)
+		cmd->env = git_env_list;
 }
 
 int run_command_v_opt(const char **argv, int opt)
diff --git a/run-command.h b/run-command.h
index 7958eb1..a5374cc 100644
--- a/run-command.h
+++ b/run-command.h
@@ -33,6 +33,7 @@ int run_command(struct child_process *);
 #define RUN_COMMAND_NO_STDIN 1
 #define RUN_GIT_CMD	     2	/*If this is to be git sub-command */
 #define RUN_COMMAND_STDOUT_TO_STDERR 4
+#define RUN_COMMAND_CLEAR_GIT_ENV	(1 << 3)
 int run_command_v_opt(const char **argv, int opt);
 int run_command_v_opt_cd(const char **argv, int opt, const char *dir);
 
-- 
1.5.2.838.gbeec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-25 23:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-25 21:07 [PATCH 1/3] run-command: optionally clear git environment skimo
2007-05-25 21:07 ` [PATCH 2/3] entry.c: checkout available submodules skimo
2007-05-25 21:31   ` Martin Waitz
2007-05-25 21:42     ` Sven Verdoolaege
2007-05-25 22:19       ` Martin Waitz
2007-05-25 23:06         ` Junio C Hamano
2007-05-25 21:07 ` [PATCH 3/3] test for simple submodule checkout support skimo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).