aboutsummaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-27 13:57:16 -0800
committerJunio C Hamano <gitster@pobox.com>2017-02-27 13:57:16 -0800
commitace83dc26a13ada8f6b2c011b01fc0ae9e48b86f (patch)
tree7e66e48d3ebd4660bc7c708ec099f46629e5bc1c /remote.c
parent036465a248df7b0876e65d0e137826203305c606 (diff)
parent4b0c3c7735716e8e1faba9a25b4aebf019d8570a (diff)
downloadgit-ace83dc26a13ada8f6b2c011b01fc0ae9e48b86f.tar.gz
git-ace83dc26a13ada8f6b2c011b01fc0ae9e48b86f.tar.xz
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 'remote.c')
-rw-r--r--remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index bf1bf2309..9f83fe2c4 100644
--- a/remote.c
+++ b/remote.c
@@ -693,7 +693,7 @@ static struct remote *remote_get_1(const char *name,
name = get_default(current_branch, &name_given);
ret = make_remote(name, 0);
- if (valid_remote_nick(name)) {
+ if (valid_remote_nick(name) && have_git_dir()) {
if (!valid_remote(ret))
read_remotes_file(ret);
if (!valid_remote(ret))