summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-10-24 14:57:53 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-24 14:57:54 -0700
commit217610d7d61864f24efc0ea837dc911be44fd9c6 (patch)
treeebcbe1cde6d22498c7007a0b3e117e93168378f8 /transport-helper.c
parentf35a02b15d22521c4902d8b3434c7c55eeab4a1d (diff)
parenta915459097b72da9cc058172a54029352b684b0f (diff)
downloadgit-217610d7d61864f24efc0ea837dc911be44fd9c6.tar.gz
Merge branch 'rs/run-command-env-array'
Add managed "env" array to child_process to clarify the lifetime rules. * rs/run-command-env-array: use env_array member of struct child_process run-command: add env_array, an optional argv_array for env
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 9b2962041b..6cd9dd1f9f 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -108,12 +108,6 @@ static struct child_process *get_helper(struct transport *transport)
int refspec_alloc = 0;
int duped;
int code;
- char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1];
- const char *helper_env[] = {
- git_dir_buf,
- NULL
- };
-
if (data->helper)
return data->helper;
@@ -129,8 +123,8 @@ static struct child_process *get_helper(struct transport *transport)
helper->git_cmd = 0;
helper->silent_exec_failure = 1;
- snprintf(git_dir_buf, sizeof(git_dir_buf), "%s=%s", GIT_DIR_ENVIRONMENT, get_git_dir());
- helper->env = helper_env;
+ argv_array_pushf(&helper->env_array, "%s=%s", GIT_DIR_ENVIRONMENT,
+ get_git_dir());
code = start_command(helper);
if (code < 0 && errno == ENOENT)