summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-17 13:40:37 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-14 22:29:57 -0400
commit0acaf3a8eb7c3276b7864df8f5588c7007b38f35 (patch)
treea5f6a678339651be6c9681f84a489950d34b9fb2 /include
parentdbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (diff)
downloadlibgit2-0acaf3a8eb7c3276b7864df8f5588c7007b38f35.tar.gz
oid: define GIT_OID_SHA1_ZERO
Callers should not assume the layout of the oid structure; provide them a macro that defines the null / zero sha1 object id.
Diffstat (limited to 'include')
-rw-r--r--include/git2/common.h5
-rw-r--r--include/git2/oid.h10
2 files changed, 10 insertions, 5 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index c3e3e7b4e..ccf66334a 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -106,11 +106,6 @@ GIT_BEGIN_DECL
#define GIT_PATH_MAX 4096
/**
- * The string representation of the null object ID.
- */
-#define GIT_OID_HEX_ZERO "0000000000000000000000000000000000000000"
-
-/**
* Return the version of the libgit2 library
* being currently used.
*
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 0d0f05489..3dedae85e 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -36,6 +36,16 @@ typedef struct git_oid {
} git_oid;
/**
+ * The binary representation of the null object ID.
+ */
+#define GIT_OID_SHA1_ZERO { { 0 } }
+
+/**
+ * The string representation of the null object ID.
+ */
+#define GIT_OID_SHA1_HEXZERO "0000000000000000000000000000000000000000"
+
+/**
* Parse a hex formatted object id into a git_oid.
*
* @param out oid structure the result is written into.