MCPcopy Create free account
hub / github.com/git/git / oidtree_lookup

Function oidtree_lookup

oidtree.c:59–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59static struct oidtree_node *oidtree_lookup(struct oidtree *ot,
60 const struct object_id *oid)
61{
62 struct object_id k;
63 size_t klen = sizeof(k);
64 struct cb_node *node;
65
66 oidcpy(&k, oid);
67
68 if (oid->algo == GIT_HASH_UNKNOWN)
69 klen -= sizeof(oid->algo);
70
71 /* cb_lookup relies on memcmp on the struct, so order matters: */
72 klen += BUILD_ASSERT_OR_ZERO(offsetof(struct object_id, hash) <
73 offsetof(struct object_id, algo));
74
75 node = cb_lookup(&ot->tree, (const uint8_t *)&k, klen);
76 return node ? container_of(node, struct oidtree_node, base) : NULL;
77}
78
79bool oidtree_contains(struct oidtree *ot, const struct object_id *oid)
80{

Callers 2

oidtree_containsFunction · 0.85
oidtree_getFunction · 0.85

Calls 2

oidcpyFunction · 0.85
cb_lookupFunction · 0.85

Tested by

no test coverage detected