MCPcopy Create free account
hub / github.com/libgit2/pygit2 / Odb_read_header

Function Odb_read_header

src/odb.c:222–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 "so the whole object may be read and then the header will be returned.");
221
222PyObject *
223Odb_read_header(Odb *self, PyObject *py_hex)
224{
225 git_oid oid;
226 int err;
227 size_t len;
228 git_object_t type;
229 PyObject* type_enum;
230 PyObject* tuple;
231
232 len = py_oid_to_git_oid(py_hex, &oid);
233 if (len == 0)
234 return NULL;
235
236 err = git_odb_read_header(&len, &type, self->odb, &oid);
237 if (err != 0) {
238 Error_set_oid(err, &oid, len);
239 return NULL;
240 }
241
242 // Convert type to ObjectType enum
243 type_enum = pygit2_enum(ObjectTypeEnum, type);
244
245 tuple = Py_BuildValue("(On)", type_enum, len);
246 return tuple;
247}
248
249PyDoc_STRVAR(Odb_write__doc__,
250 "write(type: int, data: bytes) -> Oid\n"

Callers

nothing calls this directly

Calls 3

py_oid_to_git_oidFunction · 0.85
Error_set_oidFunction · 0.85
pygit2_enumFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…