git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: skimo@liacs.nl
To: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Cc: Martin Waitz <tali@admingilde.org>, Alex Riesen <raa.lkml@gmail.com>
Subject: [PATCH 1/3] run-command: optionally clear git environment
Date: Fri, 25 May 2007 23:07:11 +0200	[thread overview]
Message-ID: <1180127233729-git-send-email-skimo@liacs.nl> (raw)

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

             reply	other threads:[~2007-05-25 21:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 21:07 skimo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1180127233729-git-send-email-skimo@liacs.nl \
    --to=skimo@liacs.nl \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=raa.lkml@gmail.com \
    --cc=tali@admingilde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).