From b419aa25d5622268f515b26e76420eb2dd89e7e6 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 10 Nov 2015 02:22:19 +0000 Subject: sha1_file: introduce has_object_file helper. Add has_object_file, which is a wrapper around has_sha1_file, but for struct object_id. Signed-off-by: brian m. carlson Signed-off-by: Jeff King diff --git a/cache.h b/cache.h index 736abc0..614040e 100644 --- a/cache.h +++ b/cache.h @@ -1030,6 +1030,9 @@ static inline int has_sha1_file(const unsigned char *sha1) return has_sha1_file_with_flags(sha1, 0); } +/* Same as the above, except for struct object_id. */ +extern int has_object_file(const struct object_id *oid); + /* * Return true iff an alternate object database has a loose object * with the specified name. This function does not respect replace diff --git a/sha1_file.c b/sha1_file.c index 3d56746..27ce7b7 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -3216,6 +3216,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags) return find_pack_entry(sha1, &e); } +int has_object_file(const struct object_id *oid) +{ + return has_sha1_file(oid->hash); +} + static void check_tree(const void *buf, size_t size) { struct tree_desc desc; -- cgit v0.10.2-6-g49f6