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

Function Reference_rename

src/reference.c:215–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 "Rename the reference.");
214
215PyObject *
216Reference_rename(Reference *self, PyObject *py_name)
217{
218 CHECK_REFERENCE(self);
219
220 // Get the C name
221 PyObject *tvalue;
222 char *c_name = pgit_borrow_fsdefault(py_name, &tvalue);
223 if (c_name == NULL)
224 return NULL;
225
226 // Rename
227 git_reference *new_reference;
228 int err = git_reference_rename(&new_reference, self->reference, c_name, 0, NULL);
229 Py_DECREF(tvalue);
230 if (err)
231 return Error_set(err);
232
233 // Update reference
234 git_reference_free(self->reference);
235 self->reference = new_reference;
236
237 Py_RETURN_NONE;
238}
239
240
241PyDoc_STRVAR(Reference_resolve__doc__,

Callers

nothing calls this directly

Calls 2

pgit_borrow_fsdefaultFunction · 0.85
Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…