From fa4b93a61cf0a28bf8359bc32e96a0ea5020b6b6 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 11 Apr 2016 15:57:23 -0400 Subject: [PATCH] backport git_oid__cpy_prefix --- src/oid.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/oid.h b/src/oid.h index aa1f0bfdc..922a2a347 100644 --- a/src/oid.h +++ b/src/oid.h @@ -44,4 +44,13 @@ GIT_INLINE(int) git_oid__cmp(const git_oid *a, const git_oid *b) return git_oid__hashcmp(a->id, b->id); } +GIT_INLINE(void) git_oid__cpy_prefix( + git_oid *out, const git_oid *id, size_t len) +{ + memcpy(&out->id, id->id, (len + 1) / 2); + + if (len & 1) + out->id[len / 2] &= 0xF0; +} + #endif