summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-20 04:37:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-20 04:37:20 (GMT)
commiteb3af74e93953df7917dca43d264ac8d1fb85671 (patch)
tree11c6b0ae899ca4c5994e1b6d04f9bd9e4c01f251 /sha1_file.c
parent5ab8f2261fa2b595abe433dd50be0f2aaec14aa0 (diff)
parentbccb22cbb15d45c940da4c54231949c722d4fe30 (diff)
downloadgit-eb3af74e93953df7917dca43d264ac8d1fb85671.zip
git-eb3af74e93953df7917dca43d264ac8d1fb85671.tar.gz
git-eb3af74e93953df7917dca43d264ac8d1fb85671.tar.bz2
Merge branch 'jk/no-looking-at-dotgit-outside-repo'
Clean up fallouts from recent tightening of the set-up sequence, where Git barfs when repository information is accessed without first ensuring that it was started in a repository. * jk/no-looking-at-dotgit-outside-repo: test-read-cache: setup git dir has_sha1_file: don't bother if we are not in a repository
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 2270f36..1577e2d 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3481,6 +3481,8 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
{
struct pack_entry e;
+ if (!startup_info->have_repository)
+ return 0;
if (find_pack_entry(sha1, &e))
return 1;
if (has_loose_object(sha1))