summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-02-27 13:57:16 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-02-27 13:57:16 -0800
commitace83dc26a13ada8f6b2c011b01fc0ae9e48b86f (patch)
tree7e66e48d3ebd4660bc7c708ec099f46629e5bc1c /remote.c
parentMerge branch 'jk/grep-no-index-fix' (diff)
parentremote helpers: avoid blind fall-back to ".git" when setting GIT_DIR (diff)
downloadtgif-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 bf1bf23091..9f83fe2c4c 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))