Skip to content

Commit 5ff9f23

Browse files
committed
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
2 parents 541dc4d + 45e8a74 commit 5ff9f23

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sha1_file.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2995,7 +2995,10 @@ int has_sha1_file(const unsigned char *sha1)
29952995

29962996
if (find_pack_entry(sha1, &e))
29972997
return 1;
2998-
return has_loose_object(sha1);
2998+
if (has_loose_object(sha1))
2999+
return 1;
3000+
reprepare_packed_git();
3001+
return find_pack_entry(sha1, &e);
29993002
}
30003003

30013004
static void check_tree(const void *buf, size_t size)

0 commit comments

Comments
 (0)