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

Function Branch_upstream__set__

src/branch.c:221–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221int Branch_upstream__set__(Branch *self, Reference *py_ref)
222{
223 int err;
224 const char *branch_name = NULL;
225
226 CHECK_REFERENCE_INT(self);
227
228 if ((PyObject *)py_ref != Py_None) {
229 if (!PyObject_TypeCheck(py_ref, (PyTypeObject *)&ReferenceType)) {
230 PyErr_SetObject(PyExc_TypeError, (PyObject *)py_ref);
231 return -1;
232 }
233
234 CHECK_REFERENCE_INT(py_ref);
235 err = git_branch_name(&branch_name, py_ref->reference);
236 if (err < GIT_OK) {
237 Error_set(err);
238 return -1;
239 }
240 }
241
242 err = git_branch_set_upstream(self->reference, branch_name);
243 if (err < GIT_OK) {
244 Error_set(err);
245 return -1;
246 }
247
248 return 0;
249}
250
251
252PyDoc_STRVAR(Branch_upstream_name__doc__,

Callers

nothing calls this directly

Calls 1

Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…