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

Function Repository_lookup_reference

src/repository.c:1549–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1547 "Lookup a reference by its name in a repository.");
1548
1549PyObject *
1550Repository_lookup_reference(Repository *self, PyObject *py_name)
1551{
1552 /* 1- Get the C name */
1553 PyObject *tvalue;
1554 char *c_name = pgit_borrow_fsdefault(py_name, &tvalue);
1555 if (c_name == NULL)
1556 return NULL;
1557
1558 /* 2- Lookup */
1559 git_reference *c_reference;
1560 int err = git_reference_lookup(&c_reference, self->repo, c_name);
1561 if (err) {
1562 PyObject *err_obj = Error_set_str(err, c_name);
1563 Py_DECREF(tvalue);
1564 return err_obj;
1565 }
1566 Py_DECREF(tvalue);
1567
1568 /* 3- Make an instance of Reference and return it */
1569 return wrap_reference(c_reference, self);
1570}
1571
1572PyDoc_STRVAR(Repository_lookup_reference_dwim__doc__,
1573 "lookup_reference_dwim(name: str) -> Reference\n"

Callers

nothing calls this directly

Calls 3

pgit_borrow_fsdefaultFunction · 0.85
Error_set_strFunction · 0.85
wrap_referenceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…