Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2017-04-12 01:47:13 +0300
committerJunio C Hamano <gitster@pobox.com>2017-04-14 04:33:11 +0300
commit3e8b7d3c77c464b29f7f3e0627ca7354f7de433a (patch)
tree0baf768667701ea44eb67bd58d512ac82cf496fa /sha1_file.c
parent3e98919a188e36f34c1a20e23ecf2ff1f5da75c9 (diff)
has_sha1_file: don't bother if we are not in a repository
Most callers to this function already require that they are in a git repository, but there is an exception: "git apply" uses has_sha1_file to avoid work if the result of applying a binary patch is already present in the repository. When run outside any repository, this produces an error: fatal: BUG: setup_git_env called without repository Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 2eda9291ee..18bfb4f448 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3320,6 +3320,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))