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

Function RefdbBackend_lookup

src/refdb_backend.c:545–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543 "Looks up a reference and returns it, or None if not found.");
544
545PyObject *
546RefdbBackend_lookup(RefdbBackend *self, PyObject *py_str)
547{
548 int err;
549 git_reference *ref;
550 const char *ref_name;
551 if (self->refdb_backend->lookup == NULL) {
552 Py_INCREF(Py_NotImplemented);
553 return Py_NotImplemented;
554 }
555
556 if (!PyUnicode_Check(py_str)) {
557 PyErr_SetString(PyExc_TypeError,
558 "RefdbBackend.lookup takes a string argument");
559 return NULL;
560 }
561 ref_name = PyUnicode_AsUTF8(py_str);
562
563 err = self->refdb_backend->lookup(&ref, self->refdb_backend, ref_name);
564
565 if (err == GIT_ENOTFOUND) {
566 Py_RETURN_NONE;
567 } else if (err != 0) {
568 return Error_set(err);
569 }
570
571 return wrap_reference(ref, NULL);
572}
573
574PyDoc_STRVAR(RefdbBackend_write__doc__,
575 "write(ref: Reference, force: bool, who: Signature, message: str, old: Oid, old_target: str)\n"

Callers

nothing calls this directly

Calls 3

Error_setFunction · 0.85
wrap_referenceFunction · 0.85
lookupMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…