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

Function Repository_list_worktrees

src/repository.c:2175–2206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2173 "\n"
2174 "Return a list with all the worktrees of this repository.");
2175PyObject *
2176Repository_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
2203out:
2204 git_strarray_dispose(&c_result);
2205 return py_result;
2206}
2207
2208PyDoc_STRVAR(Repository_apply__doc__,
2209 "apply(diff: Diff, location: ApplyLocation = ApplyLocation.WORKDIR)\n"

Callers

nothing calls this directly

Calls 1

Error_setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…