| 141 | } |
| 142 | |
| 143 | int |
| 144 | Reference_init(Reference *self, PyObject *args, PyObject *kwds) |
| 145 | { |
| 146 | const char *name; |
| 147 | git_oid oid, peel; |
| 148 | PyObject *py_oid, *py_peel; |
| 149 | |
| 150 | if (kwds && PyDict_Size(kwds) > 0) { |
| 151 | PyErr_SetString(PyExc_TypeError, "Reference takes no keyword arguments"); |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | Py_ssize_t nargs = PyTuple_Size(args); |
| 156 | if (nargs == 2) { |
| 157 | return Reference_init_symbolic(self, args, kwds); |
| 158 | } else if (nargs != 3) { |
| 159 | PyErr_SetString(PyExc_TypeError, |
| 160 | "Invalid arguments to Reference constructor"); |
| 161 | return -1; |
| 162 | } |
| 163 | |
| 164 | if (!PyArg_ParseTuple(args, "sOO", &name, &py_oid, &py_peel)) { |
| 165 | return -1; |
| 166 | } |
| 167 | |
| 168 | py_oid_to_git_oid(py_oid, &oid); |
| 169 | if (py_peel != Py_None) { |
| 170 | py_oid_to_git_oid(py_peel, &peel); |
| 171 | } |
| 172 | |
| 173 | self->reference = git_reference__alloc(name, &oid, &peel); |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | void |
| 178 | Reference_dealloc(Reference *self) |
nothing calls this directly
no test coverage detected
searching dependent graphs…