Commit 983e627d10215807d2727cc8321d83d02f11fee7

Patrick Steinhardt 2017-06-13T11:38:59

tests: odb: use correct OID length The `search_object` function takes the OID length as one of its parameters, where its maximum length is `GIT_OID_HEXSZ`. The `exists` function of the fake backend used `GIT_OID_RAWSZ` though, leading to only the first half of the OID being used when finding the correct object.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/tests/odb/backend/backend_helpers.c b/tests/odb/backend/backend_helpers.c
index 3317136..f9211e7 100644
--- a/tests/odb/backend/backend_helpers.c
+++ b/tests/odb/backend/backend_helpers.c
@@ -34,7 +34,7 @@ static int fake_backend__exists(git_odb_backend *backend, const git_oid *oid)
 
 	fake->exists_calls++;
 
-	return search_object(NULL, fake, oid, GIT_OID_RAWSZ) == GIT_OK;
+	return search_object(NULL, fake, oid, GIT_OID_HEXSZ) == GIT_OK;
 }
 
 static int fake_backend__read(