object-store: prepare has_{sha1, object}_file to handle any repo
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
afd69dcc21
commit
9b45f49981
15
sha1-file.c
15
sha1-file.c
@ -1768,24 +1768,27 @@ int force_object_loose(const struct object_id *oid, time_t mtime)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
|
||||
int repo_has_sha1_file_with_flags(struct repository *r,
|
||||
const unsigned char *sha1, int flags)
|
||||
{
|
||||
struct object_id oid;
|
||||
if (!startup_info->have_repository)
|
||||
return 0;
|
||||
hashcpy(oid.hash, sha1);
|
||||
return oid_object_info_extended(the_repository, &oid, NULL,
|
||||
return oid_object_info_extended(r, &oid, NULL,
|
||||
flags | OBJECT_INFO_SKIP_CACHED) >= 0;
|
||||
}
|
||||
|
||||
int has_object_file(const struct object_id *oid)
|
||||
int repo_has_object_file(struct repository *r,
|
||||
const struct object_id *oid)
|
||||
{
|
||||
return has_sha1_file(oid->hash);
|
||||
return repo_has_sha1_file(r, oid->hash);
|
||||
}
|
||||
|
||||
int has_object_file_with_flags(const struct object_id *oid, int flags)
|
||||
int repo_has_object_file_with_flags(struct repository *r,
|
||||
const struct object_id *oid, int flags)
|
||||
{
|
||||
return has_sha1_file_with_flags(oid->hash, flags);
|
||||
return repo_has_sha1_file_with_flags(r, oid->hash, flags);
|
||||
}
|
||||
|
||||
static void check_tree(const void *buf, size_t size)
|
||||
|
||||
Reference in New Issue
Block a user