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

Function tree_getentry_by_path

src/tree.c:159–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159PyObject*
160tree_getentry_by_path(const git_tree *tree, Repository *repo, PyObject *py_path)
161{
162 PyObject *tvalue;
163 char *path = pgit_borrow_fsdefault(py_path, &tvalue);
164 if (path == NULL) {
165 PyErr_SetString(PyExc_TypeError, "Value must be a path string");
166 return NULL;
167 }
168
169 git_tree_entry *entry;
170 int err = git_tree_entry_bypath(&entry, tree, path);
171 Py_DECREF(tvalue);
172
173 if (err == GIT_ENOTFOUND) {
174 PyErr_SetObject(PyExc_KeyError, py_path);
175 return NULL;
176 }
177
178 if (err < 0)
179 return Error_set(err);
180
181 /* git_tree_entry_dup is already done in git_tree_entry_bypath */
182 return treeentry_to_object(entry, repo);
183}
184
185PyObject*
186Tree_subscript(Tree *self, PyObject *value)

Callers 2

Tree_subscriptFunction · 0.85
Tree_divideFunction · 0.85

Calls 3

pgit_borrow_fsdefaultFunction · 0.85
Error_setFunction · 0.85
treeentry_to_objectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…