diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-24 12:57:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-24 12:57:53 -0700 |
commit | 411a1794120fa044f92ff53f41a4aa81018ed507 (patch) | |
tree | 9cf263a641eaf66f0d6f7b3f5b0ab187383419dc /transport-helper.c | |
parent | f3d5bbb28322307592f9e5f5f21e69ff0249eea7 (diff) | |
parent | 4b0c3c7735716e8e1faba9a25b4aebf019d8570a (diff) | |
download | git-411a1794120fa044f92ff53f41a4aa81018ed507.tar.gz |
Merge branch 'jn/remote-helpers-with-git-dir' into maint
"git ls-remote" and "git archive --remote" are designed to work
without being in a directory under Git's control. However, recent
updates revealed that we randomly look into a directory called
.git/ without actually doing necessary set-up when working in a
repository. Stop doing so.
* jn/remote-helpers-with-git-dir:
remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
remote: avoid reading $GIT_DIR config in non-repo
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/transport-helper.c b/transport-helper.c index 1258d6aedd..dc90a1fb76 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -124,8 +124,9 @@ static struct child_process *get_helper(struct transport *transport) helper->git_cmd = 0; helper->silent_exec_failure = 1; - argv_array_pushf(&helper->env_array, "%s=%s", GIT_DIR_ENVIRONMENT, - get_git_dir()); + if (have_git_dir()) + argv_array_pushf(&helper->env_array, "%s=%s", + GIT_DIR_ENVIRONMENT, get_git_dir()); code = start_command(helper); if (code < 0 && errno == ENOENT) |