summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-17 18:41:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-09-17 18:41:35 (GMT)
commit5ff9f2351a4d4dc31b0b11258d587c95826acc57 (patch)
tree2d8602481448fe260daa2189a238862c8b39fcec /sha1_file.c
parent541dc4dfa07f70e66e244be566480ed4699b4fc9 (diff)
parent45e8a7487339c0f0ea28244ef06851308d07387c (diff)
downloadgit-5ff9f2351a4d4dc31b0b11258d587c95826acc57.zip
git-5ff9f2351a4d4dc31b0b11258d587c95826acc57.tar.gz
git-5ff9f2351a4d4dc31b0b11258d587c95826acc57.tar.bz2
Merge branch 'jk/has-sha1-file-retry-packed'
When an object is not found after checking the packfiles and then loose object directory, read_sha1_file() re-checks the packfiles to prevent racing with a concurrent repacker; teach the same logic to has_sha1_file(). * jk/has-sha1-file-retry-packed: has_sha1_file: re-check pack directory before giving up
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 8c2d1ed..f1b6497 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2995,7 +2995,10 @@ int has_sha1_file(const unsigned char *sha1)
if (find_pack_entry(sha1, &e))
return 1;
- return has_loose_object(sha1);
+ if (has_loose_object(sha1))
+ return 1;
+ reprepare_packed_git();
+ return find_pack_entry(sha1, &e);
}
static void check_tree(const void *buf, size_t size)