[PATCH v8 7/8] cache: add empty_tree_oid object

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

 



From: Jacob Keller <jacob.keller@xxxxxxxxx>

Add an empty_tree_oid object which can be used in place of
EMPTY_TREE_SHA1_BIN_LITERAL for code which is being converted to struct
object_id.

Signed-off-by: Jacob Keller <jacob.keller@xxxxxxxxx>
---
 cache.h     | 2 ++
 sha1_file.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/cache.h b/cache.h
index f30a4417efdf..da9f0be67d7b 100644
--- a/cache.h
+++ b/cache.h
@@ -964,6 +964,8 @@ static inline void oidclr(struct object_id *oid)
 #define EMPTY_BLOB_SHA1_BIN \
 	((const unsigned char *) EMPTY_BLOB_SHA1_BIN_LITERAL)
 
+extern const struct object_id empty_tree_oid;
+
 static inline int is_empty_blob_sha1(const unsigned char *sha1)
 {
 	return !hashcmp(sha1, EMPTY_BLOB_SHA1_BIN);
diff --git a/sha1_file.c b/sha1_file.c
index 1e23fc186a02..10883d56a600 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -38,6 +38,9 @@ static inline uintmax_t sz_fmt(size_t s) { return s; }
 
 const unsigned char null_sha1[20];
 const struct object_id null_oid;
+const struct object_id empty_tree_oid = {
+	.hash = EMPTY_TREE_SHA1_BIN_LITERAL
+};
 
 /*
  * This is meant to hold a *small* number of objects that you would
-- 
2.10.0.rc0.217.g609f9e8.dirty

--
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]