Commit e86e81c5d97aa6879b0e7850f734c606cbbd2a90

Edward Thomson 2022-02-12T06:58:05

oid: make empty tree id global Move the empty tree ID into a global space so that it can be generally used.

diff --git a/src/oid.c b/src/oid.c
index dbc5a5a..1a50d3d 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -13,6 +13,10 @@
 #include <string.h>
 #include <limits.h>
 
+const git_oid git_oid__empty_tree_sha1 =
+	{{ 0x4b, 0x82, 0x5d, 0xc6, 0x42, 0xcb, 0x6e, 0xb9, 0xa0, 0x60,
+	   0xe5, 0x4b, 0xf8, 0xd6, 0x92, 0x88, 0xfb, 0xee, 0x49, 0x04 }};
+
 static char to_hex[] = "0123456789abcdef";
 
 static int oid_error_invalid(const char *msg)
diff --git a/src/oid.h b/src/oid.h
index 7a89d21..5c9b68f 100644
--- a/src/oid.h
+++ b/src/oid.h
@@ -11,6 +11,8 @@
 
 #include "git2/oid.h"
 
+extern const git_oid git_oid__empty_tree_sha1;
+
 /**
  * Format a git_oid into a newly allocated c-string.
  *