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

Function pygit2_refdb_backend_rename

src/refdb_backend.c:242–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242static int
243pygit2_refdb_backend_rename(git_reference **out, git_refdb_backend *_be,
244 const char *old_name, const char *new_name, int force,
245 const git_signature *_who, const char *message)
246{
247 int err;
248 PyObject *args, *who;
249 struct pygit2_refdb_backend *be = (struct pygit2_refdb_backend *)_be;
250
251 if ((who = build_signature(NULL, _who, "utf-8")) != NULL)
252 return GIT_EUSER;
253 if ((args = Py_BuildValue("(ssNNs)", old_name, new_name,
254 force ? Py_True : Py_False, who, message)) == NULL) {
255 Py_DECREF(who);
256 return GIT_EUSER;
257 }
258 Reference *ref = (Reference *)PyObject_CallObject(be->rename, args);
259 Py_DECREF(who);
260 Py_DECREF(args);
261
262 if ((err = git_error_for_exc()) != 0)
263 return err;
264
265 if (!PyObject_IsInstance((PyObject *)ref, (PyObject *)&ReferenceType)) {
266 PyErr_SetString(PyExc_TypeError, "Expected object of type pygit2.Reference");
267 return GIT_EUSER;
268 }
269
270 git_reference_dup(out, ref->reference);
271 Py_DECREF(ref);
272 return 0;
273}
274
275static int
276pygit2_refdb_backend_del(git_refdb_backend *_be,

Callers

nothing calls this directly

Calls 2

build_signatureFunction · 0.85
git_error_for_excFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…