summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2009-09-11 17:40:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-09-11 23:33:54 (GMT)
commit2affea4125a0ae6c528a14f14731748c1fad9a8a (patch)
tree81ba1ff206e66c92aa340ba4615a3d901039b150 /run-command.c
parent434a6db7dcf8688fe08098e218113c18b7c9aeaf (diff)
downloadgit-2affea4125a0ae6c528a14f14731748c1fad9a8a.zip
git-2affea4125a0ae6c528a14f14731748c1fad9a8a.tar.gz
git-2affea4125a0ae6c528a14f14731748c1fad9a8a.tar.bz2
start_command: do not clobber cmd->env on Windows code path
Previously, it would not be possible to call start_command twice for the same struct child_process that has env set. The fix is achieved by moving the loop that modifies the environment block into a helper function. This also allows us to make two other helper functions static. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/run-command.c b/run-command.c
index f3e7abb..ac314a5 100644
--- a/run-command.c
+++ b/run-command.c
@@ -173,11 +173,8 @@ fail_pipe:
if (cmd->dir)
die("chdir in start_command() not implemented");
- if (cmd->env) {
- env = copy_environ();
- for (; *cmd->env; cmd->env++)
- env = env_setenv(env, *cmd->env);
- }
+ if (cmd->env)
+ env = make_augmented_environ(cmd->env);
if (cmd->git_cmd) {
cmd->argv = prepare_git_cmd(cmd->argv);