diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-02-27 13:57:16 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-27 13:57:16 -0800 |
commit | ace83dc26a13ada8f6b2c011b01fc0ae9e48b86f (patch) | |
tree | 7e66e48d3ebd4660bc7c708ec099f46629e5bc1c /transport-helper.c | |
parent | 036465a248df7b0876e65d0e137826203305c606 (diff) | |
parent | 4b0c3c7735716e8e1faba9a25b4aebf019d8570a (diff) | |
download | git-ace83dc26a13ada8f6b2c011b01fc0ae9e48b86f.tar.gz |
Merge branch 'jn/remote-helpers-with-git-dir'
"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) |