Commit 0c72248b9171acee7480a77edee89fa20fabdae8

Russell Belfer 2013-04-29T07:34:13

Introduce git_oid_compare, an exported oid cmp

diff --git a/include/git2/oid.h b/include/git2/oid.h
index 862f4b2..c35acdc 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -145,6 +145,15 @@ GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
  * @param b second oid structure.
  * @return <0, 0, >0 if a < b, a == b, a > b.
  */
+GIT_EXTERN(int) git_oid_compare(const git_oid *oid_a, const git_oid *oid_b);
+
+/**
+ * Compare two oid structures.
+ *
+ * @param a first oid structure.
+ * @param b second oid structure.
+ * @return <0, 0, >0 if a < b, a == b, a > b.
+ */
 GIT_INLINE(int) git_oid_cmp(const git_oid *a, const git_oid *b)
 {
 	const unsigned char *sha1 = a->id;
diff --git a/src/oid.c b/src/oid.c
index ab69eeb..59c1546 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -166,6 +166,11 @@ void git_oid_cpy(git_oid *out, const git_oid *src)
 	memcpy(out->id, src->id, sizeof(out->id));
 }
 
+int git_oid_compare(const git_oid *oid_a, const git_oid *oid_b)
+{
+	return git_oid_cmp(oid_a, oid_b);
+}
+
 int git_oid_ncmp(const git_oid *oid_a, const git_oid *oid_b, size_t len)
 {
 	const unsigned char *a = oid_a->id;