summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:19 +0000
committerLibravatar Jeff King <peff@peff.net>2015-11-20 08:02:05 -0500
commitb419aa25d5622268f515b26e76420eb2dd89e7e6 (patch)
treed508c65143f4a0680786a57c68fc5f12dfbb9935
parentMerge branch 'master' of git://git.bogomips.org/git-svn (diff)
downloadtgif-b419aa25d5622268f515b26e76420eb2dd89e7e6.tar.xz
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>
-rw-r--r--cache.h3
-rw-r--r--sha1_file.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 736abc03a4..614040e700 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 3d56746a9b..27ce7b705e 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;