We have hardcoded an empty tree for a long time. This teaches the code
about an empty blob object.
Signed-off-by: Junio C Hamano <redacted>
---
sha1_file.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index d9e342e..1e5de12 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2002,6 +2002,15 @@ static struct cached_object empty_tree = {
0
};
+static struct cached_object empty_blob = {
+ /* empty blob sha1: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 */
+ "\xe6\x9d\xe2\x9b\xb2\xd1\xd6\x43\x4b\x8b"
+ "\x29\xae\x77\x5a\xd8\xc2\xe4\x8c\x53\x91",
+ OBJ_BLOB,
+ "",
+ 0
+};
+
static struct cached_object *find_cached_object(const unsigned char *sha1)
{
int i;@@ -2013,6 +2022,8 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)
}
if (!hashcmp(sha1, empty_tree.sha1))
return &empty_tree;
+ if (!hashcmp(sha1, empty_blob.sha1))
+ return &empty_blob;
return NULL;
}
--
1.6.0.51.g078ae