| 2173 | "\n" |
| 2174 | "Return a list with all the worktrees of this repository."); |
| 2175 | PyObject * |
| 2176 | Repository_list_worktrees(Repository *self, PyObject *args) |
| 2177 | { |
| 2178 | git_strarray c_result; |
| 2179 | PyObject *py_result, *py_string; |
| 2180 | unsigned index; |
| 2181 | int err; |
| 2182 | |
| 2183 | /* Get the C result */ |
| 2184 | err = git_worktree_list(&c_result, self->repo); |
| 2185 | if (err < 0) |
| 2186 | return Error_set(err); |
| 2187 | |
| 2188 | /* Create a new PyTuple */ |
| 2189 | py_result = PyList_New(c_result.count); |
| 2190 | if (py_result == NULL) |
| 2191 | goto out; |
| 2192 | |
| 2193 | /* Fill it */ |
| 2194 | for (index=0; index < c_result.count; index++) { |
| 2195 | py_string = PyUnicode_DecodeFSDefault(c_result.strings[index]); |
| 2196 | if (py_string == NULL) { |
| 2197 | Py_CLEAR(py_result); |
| 2198 | goto out; |
| 2199 | } |
| 2200 | PyList_SET_ITEM(py_result, index, py_string); |
| 2201 | } |
| 2202 | |
| 2203 | out: |
| 2204 | git_strarray_dispose(&c_result); |
| 2205 | return py_result; |
| 2206 | } |
| 2207 | |
| 2208 | PyDoc_STRVAR(Repository_apply__doc__, |
| 2209 | "apply(diff: Diff, location: ApplyLocation = ApplyLocation.WORKDIR)\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…