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

Function Repository_lookup_reference_dwim

src/repository.c:1577–1598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1575 "Lookup a reference by doing-what-i-mean'ing its short name.");
1576
1577PyObject *
1578Repository_lookup_reference_dwim(Repository *self, PyObject *py_name)
1579{
1580 /* 1- Get the C name */
1581 PyObject *tvalue;
1582 char *c_name = pgit_borrow_fsdefault(py_name, &tvalue);
1583 if (c_name == NULL)
1584 return NULL;
1585
1586 /* 2- Lookup */
1587 git_reference *c_reference;
1588 int err = git_reference_dwim(&c_reference, self->repo, c_name);
1589 if (err) {
1590 PyObject *err_obj = Error_set_str(err, c_name);
1591 Py_DECREF(tvalue);
1592 return err_obj;
1593 }
1594 Py_DECREF(tvalue);
1595
1596 /* 3- Make an instance of Reference and return it */
1597 return wrap_reference(c_reference, self);
1598}
1599
1600PyDoc_STRVAR(Repository_create_reference_direct__doc__,
1601 "create_reference_direct(name: str, target: Oid, force: bool, message=None) -> 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…