From 3427b375b594b93ed47ae80ca1d6bb361d7d8f5e Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 23 May 2007 22:21:39 +0200 Subject: Allow environment variables to be unset in the processes started by run_command To unset a variable, just specify its name, without "=". For example: const char *env[] = {"GIT_DIR=.git", "PWD", NULL}; const char *argv[] = {"git-ls-files", "-s", NULL}; int err = run_command_v_opt_cd_env(argv, RUN_GIT_CMD, ".", env); The PWD will be unset before executing git-ls-files. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- run-command.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'run-command.h') diff --git a/run-command.h b/run-command.h index af1e0bf178..7958eb1e0b 100644 --- a/run-command.h +++ b/run-command.h @@ -35,6 +35,11 @@ int run_command(struct child_process *); #define RUN_COMMAND_STDOUT_TO_STDERR 4 int run_command_v_opt(const char **argv, int opt); int run_command_v_opt_cd(const char **argv, int opt, const char *dir); + +/* + * env (the environment) is to be formatted like environ: "VAR=VALUE". + * To unset an environment variable use just "VAR". + */ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const char *const *env); #endif -- cgit v1.2.3