summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-24 19:57:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-24 19:57:53 (GMT)
commit411a1794120fa044f92ff53f41a4aa81018ed507 (patch)
tree9cf263a641eaf66f0d6f7b3f5b0ab187383419dc /remote.c
parentf3d5bbb28322307592f9e5f5f21e69ff0249eea7 (diff)
parent4b0c3c7735716e8e1faba9a25b4aebf019d8570a (diff)
downloadgit-411a1794120fa044f92ff53f41a4aa81018ed507.zip
git-411a1794120fa044f92ff53f41a4aa81018ed507.tar.gz
git-411a1794120fa044f92ff53f41a4aa81018ed507.tar.bz2
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 'remote.c')
-rw-r--r--remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index bf1bf23..9f83fe2 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))