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

Function Odb_init

src/odb.c:56–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56int
57Odb_init(Odb *self, PyObject *args, PyObject *kwds)
58{
59 if (kwds && PyDict_Size(kwds) > 0) {
60 PyErr_SetString(PyExc_TypeError, "Odb takes no keyword arguments");
61 return -1;
62 }
63
64 PyObject *py_path = NULL;
65 if (!PyArg_ParseTuple(args, "|O", &py_path))
66 return -1;
67
68 int err;
69 if (py_path) {
70 PyObject *tvalue;
71 char *path = pgit_borrow_fsdefault(py_path, &tvalue);
72 if (path == NULL)
73 return -1;
74 err = git_odb_open(&self->odb, path);
75 Py_DECREF(tvalue);
76 }
77 else {
78 err = git_odb_new(&self->odb);
79 }
80
81 if (err) {
82 Error_set(err);
83 return -1;
84 }
85
86 return 0;
87}
88
89void
90Odb_dealloc(Odb *self)

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…