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

Function OdbBackend_read

src/odb_backend.c:347–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345 "Read raw object data from this odb backend.\n");
346
347PyObject *
348OdbBackend_read(OdbBackend *self, PyObject *py_hex)
349{
350 int err;
351 git_oid oid;
352 git_object_t type;
353 size_t len, size;
354 void *data;
355
356 if (self->odb_backend->read == NULL)
357 Py_RETURN_NOTIMPLEMENTED;
358
359 len = py_oid_to_git_oid(py_hex, &oid);
360 if (len == 0)
361 return NULL;
362
363 err = self->odb_backend->read(&data, &size, &type, self->odb_backend, &oid);
364 if (err != 0) {
365 Error_set_oid(err, &oid, len);
366 return NULL;
367 }
368
369 PyObject *tuple = Py_BuildValue("(ny#)", type, data, size);
370
371 git_odb_backend_data_free(self->odb_backend, data);
372
373 return tuple;
374}
375
376PyDoc_STRVAR(OdbBackend_read_prefix__doc__,
377 "read_prefix(oid: Oid) -> tuple[int, bytes, Oid]\n"

Callers

nothing calls this directly

Calls 3

py_oid_to_git_oidFunction · 0.85
Error_set_oidFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…