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

Function OdbBackend_read_prefix

src/odb_backend.c:382–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380 "The returned tuple contains (type, data, oid).");
381
382PyObject *
383OdbBackend_read_prefix(OdbBackend *self, PyObject *py_hex)
384{
385 int err;
386 git_oid oid, oid_out;
387 git_object_t type;
388 size_t len, size;
389 void *data;
390
391 if (self->odb_backend->read_prefix == NULL)
392 Py_RETURN_NOTIMPLEMENTED;
393
394 len = py_oid_to_git_oid(py_hex, &oid);
395 if (len == 0)
396 return NULL;
397
398 err = self->odb_backend->read_prefix(&oid_out, &data, &size, &type, self->odb_backend, &oid, len);
399 if (err != 0) {
400 Error_set_oid(err, &oid, len);
401 return NULL;
402 }
403
404 PyObject *py_oid_out = git_oid_to_python(&oid_out);
405 if (py_oid_out == NULL)
406 return Error_set_exc(PyExc_MemoryError);
407
408 PyObject *tuple = Py_BuildValue("(ny#N)", type, data, size, py_oid_out);
409
410 git_odb_backend_data_free(self->odb_backend, data);
411
412 return tuple;
413}
414
415PyDoc_STRVAR(OdbBackend_read_header__doc__,
416 "read_header(oid) -> (type, len)\n"

Callers

nothing calls this directly

Calls 4

py_oid_to_git_oidFunction · 0.85
Error_set_oidFunction · 0.85
git_oid_to_pythonFunction · 0.85
Error_set_excFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…