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

Function pygit2_refdb_backend_write

src/refdb_backend.c:207–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207static int
208pygit2_refdb_backend_write(git_refdb_backend *_be,
209 const git_reference *_ref, int force,
210 const git_signature *_who, const char *message,
211 const git_oid *_old, const char *old_target)
212{
213 int err;
214 PyObject *args = NULL, *ref = NULL, *who = NULL, *old = NULL;
215 struct pygit2_refdb_backend *be = (struct pygit2_refdb_backend *)_be;
216
217 // XXX: Drops const
218 if ((ref = wrap_reference((git_reference *)_ref, NULL)) == NULL)
219 goto euser;
220 if ((who = build_signature(NULL, _who, "utf-8")) == NULL)
221 goto euser;
222 if ((old = git_oid_to_python(_old)) == NULL)
223 goto euser;
224 if ((args = Py_BuildValue("(NNNsNs)", ref,
225 force ? Py_True : Py_False,
226 who, message, old, old_target)) == NULL)
227 goto euser;
228
229 PyObject_CallObject(be->write, args);
230 err = git_error_for_exc();
231out:
232 Py_DECREF(ref);
233 Py_DECREF(who);
234 Py_DECREF(old);
235 Py_DECREF(args);
236 return err;
237euser:
238 err = GIT_EUSER;
239 goto out;
240}
241
242static int
243pygit2_refdb_backend_rename(git_reference **out, git_refdb_backend *_be,

Callers

nothing calls this directly

Calls 4

wrap_referenceFunction · 0.85
build_signatureFunction · 0.85
git_oid_to_pythonFunction · 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…