| 157 | } |
| 158 | |
| 159 | PyObject* |
| 160 | tree_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 | |
| 185 | PyObject* |
| 186 | Tree_subscript(Tree *self, PyObject *value) |
no test coverage detected
searching dependent graphs…