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

Function Reference_target_impl

src/reference.c:269–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267
268
269static PyObject *
270Reference_target_impl(Reference *self, const char ** c_name)
271{
272 CHECK_REFERENCE(self);
273
274 /* Case 1: Direct */
275 if (GIT_REF_OID == git_reference_type(self->reference))
276 return git_oid_to_python(git_reference_target(self->reference));
277
278 /* Case 2: Symbolic */
279 *c_name = git_reference_symbolic_target(self->reference);
280 if (*c_name == NULL)
281 PyErr_SetString(PyExc_ValueError, "no target available");
282
283 return NULL;
284}
285
286PyDoc_STRVAR(Reference_target__doc__,
287 "The reference target: If direct the value will be an Oid object, if it\n"

Callers 2

Reference_target__get__Function · 0.85

Calls 1

git_oid_to_pythonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…