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

Function RefdbBackend_exists

src/refdb_backend.c:513–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511 "Returns True if a ref by this name exists, or False otherwise.");
512
513PyObject *
514RefdbBackend_exists(RefdbBackend *self, PyObject *py_str)
515{
516 int err, exists;
517 const char *ref_name;
518 if (self->refdb_backend->exists == NULL) {
519 Py_INCREF(Py_NotImplemented);
520 return Py_NotImplemented;
521 }
522
523 if (!PyUnicode_Check(py_str)) {
524 PyErr_SetString(PyExc_TypeError,
525 "RefdbBackend.exists takes a string argument");
526 return NULL;
527 }
528 ref_name = PyUnicode_AsUTF8(py_str);
529
530 err = self->refdb_backend->exists(&exists, self->refdb_backend, ref_name);
531 if (err != 0)
532 return Error_set(err);
533
534 if (exists)
535 Py_RETURN_TRUE;
536 else
537 Py_RETURN_FALSE;
538}
539
540PyDoc_STRVAR(RefdbBackend_lookup__doc__,
541 "lookup(refname: str) -> Reference\n"

Callers

nothing calls this directly

Calls 2

Error_setFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…