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
This commit is contained in:
Junio C Hamano
2017-02-27 13:57:16 -08:00
4 changed files with 22 additions and 3 deletions

View File

@ -34,6 +34,15 @@ test_expect_success 'clone http repository' '
test_cmp file clone/file
'
test_expect_success 'list refs from outside any repository' '
cat >expect <<-EOF &&
$(git rev-parse master) HEAD
$(git rev-parse master) refs/heads/master
EOF
nongit git ls-remote "$HTTPD_URL/dumb/repo.git" >actual &&
test_cmp expect actual
'
test_expect_success 'create password-protected repository' '
mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/" &&
cp -Rf "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \