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 <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>

brian m. carlson committed Nov 10, 2015 at 02:22 UTC b419aa25d5622268f515b26e76420eb2dd89e7e6
2 files changed +8
cache.h
+3
@@ -1030,6 +1030,9 @@ static inline int has_sha1_file(const unsigned char *sha1)
1030 return has_sha1_file_with_flags(sha1, 0);
1031 }
1032
1033 +/* Same as the above, except for struct object_id. */
1034 +extern int has_object_file(const struct object_id *oid);
1035 +
1036 /*
1037 * Return true iff an alternate object database has a loose object
1038 * with the specified name. This function does not respect replace
sha1_file.c
+5
@@ -3216,6 +3216,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
3216 return find_pack_entry(sha1, &e);
3217 }
3218
3219 +int has_object_file(const struct object_id *oid)
3220 +{
3221 + return has_sha1_file(oid->hash);
3222 +}
3223 +
3224 static void check_tree(const void *buf, size_t size)
3225 {
3226 struct tree_desc desc;