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

Function Commit_tree__get__

src/commit.c:200–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198PyDoc_STRVAR(Commit_tree__doc__, "The tree object attached to the commit.");
199
200PyObject *
201Commit_tree__get__(Commit *self)
202{
203 git_tree *tree;
204
205 if (Object__load((Object*)self) == NULL) { return NULL; } // Lazy load
206
207 int err = git_commit_tree(&tree, self->commit);
208 if (err == GIT_ENOTFOUND) {
209 char tree_id[GIT_OID_HEXSZ + 1] = { 0 };
210 git_oid_fmt(tree_id, git_commit_tree_id(self->commit));
211 return PyErr_Format(GitError, "Unable to read tree %s", tree_id);
212 }
213
214 if (err < 0)
215 return Error_set(err);
216
217 return wrap_object((git_object*)tree, self->repo, NULL);
218}
219
220PyDoc_STRVAR(Commit_tree_id__doc__, "The id of the tree attached to the commit.");
221

Callers

nothing calls this directly

Calls 3

Object__loadFunction · 0.85
Error_setFunction · 0.85
wrap_objectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…