Commit 831e20ac53a7185ecf68dbfb66b515d1107a6a0c

Edward Thomson 2022-01-22T06:39:38

oidmap: hash on the id, not the object We explicitly want to hash on the id data, not the beginning of the object data, which may contain other information in the future.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/libgit2/oidmap.c b/src/libgit2/oidmap.c
index 0ae8bf3..eaf9fa0 100644
--- a/src/libgit2/oidmap.c
+++ b/src/libgit2/oidmap.c
@@ -19,7 +19,7 @@ __KHASH_TYPE(oid, const git_oid *, void *)
 GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
 {
 	khint_t h;
-	memcpy(&h, oid, sizeof(khint_t));
+	memcpy(&h, oid->id, sizeof(khint_t));
 	return h;
 }