| 2321 | } |
| 2322 | |
| 2323 | static int foreach_stash_cb(size_t index, const char *message, const git_oid *stash_id, void *payload) |
| 2324 | { |
| 2325 | int err; |
| 2326 | Stash *py_stash; |
| 2327 | |
| 2328 | py_stash = PyObject_New(Stash, &StashType); |
| 2329 | if (py_stash == NULL) |
| 2330 | return GIT_EUSER; |
| 2331 | |
| 2332 | assert(message != NULL); |
| 2333 | assert(stash_id != NULL); |
| 2334 | |
| 2335 | py_stash->commit_id = git_oid_to_python(stash_id); |
| 2336 | if (py_stash->commit_id == NULL) |
| 2337 | return GIT_EUSER; |
| 2338 | |
| 2339 | py_stash->message = strdup(message); |
| 2340 | if (py_stash->message == NULL) { |
| 2341 | PyErr_NoMemory(); |
| 2342 | return GIT_EUSER; |
| 2343 | } |
| 2344 | |
| 2345 | PyObject* list = (PyObject*) payload; |
| 2346 | err = PyList_Append(list, (PyObject*) py_stash); |
| 2347 | Py_DECREF(py_stash); |
| 2348 | if (err < 0) |
| 2349 | return GIT_EUSER; |
| 2350 | |
| 2351 | return 0; |
| 2352 | } |
| 2353 | |
| 2354 | PyDoc_STRVAR(Repository_listall_stashes__doc__, |
| 2355 | "listall_stashes() -> list[Stash]\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…