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

Function Repository__from_c

src/repository.c:143–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142PyDoc_STRVAR(Repository__from_c__doc__, "Init a Repository from a pointer. For internal use only.");
143PyObject *
144Repository__from_c(Repository *py_repo, PyObject *args)
145{
146 PyObject *py_pointer, *py_free;
147 char *buffer;
148 Py_ssize_t len;
149 int err;
150
151 py_repo->repo = NULL;
152 py_repo->config = NULL;
153 py_repo->index = NULL;
154
155 if (!PyArg_ParseTuple(args, "OO!", &py_pointer, &PyBool_Type, &py_free))
156 return NULL;
157
158 err = PyBytes_AsStringAndSize(py_pointer, &buffer, &len);
159 if (err < 0)
160 return NULL;
161
162 if (len != sizeof(git_repository *)) {
163 PyErr_SetString(PyExc_TypeError, "invalid pointer length");
164 return NULL;
165 }
166
167 py_repo->repo = *((git_repository **) buffer);
168 py_repo->owned = py_free == Py_True;
169
170 Py_RETURN_NONE;
171}
172
173PyDoc_STRVAR(Repository__disown__doc__, "Mark the object as not-owned by us. For internal use only.");
174PyObject *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…