[PATCH v3 02/13] sha1_file: introduce has_object_file helper.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add has_object_file, which is a wrapper around has_sha1_file, but for
struct object_id.

Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
---
 cache.h     | 3 +++
 sha1_file.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/cache.h b/cache.h
index 752031e8..61a686e3 100644
--- a/cache.h
+++ b/cache.h
@@ -1002,6 +1002,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 d295a322..77aa4f05 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3220,6 +3220,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;
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]