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

Function foreach_stash_cb

src/repository.c:2323–2352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2321}
2322
2323static 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
2354PyDoc_STRVAR(Repository_listall_stashes__doc__,
2355 "listall_stashes() -> list[Stash]\n"

Callers

nothing calls this directly

Calls 1

git_oid_to_pythonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…