diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-10-13 23:17:19 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-10-13 23:30:07 +0200 |
commit | 3fa735ca3b8d8f855e43be44b5f96e59909d50e1 (patch) | |
tree | 920698d515abc6a21adf3676b3694f52be80bb5a /include/git2/tree.h | |
parent | 34aff0100248dbf349240fd8edff4cc440062b40 (diff) | |
download | libgit2-3fa735ca3b8d8f855e43be44b5f96e59909d50e1.tar.gz |
tree: Add git_tree_frompath() which, given a relative path to a tree entry, retrieves the tree object containing this tree entry
Diffstat (limited to 'include/git2/tree.h')
-rw-r--r-- | include/git2/tree.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/git2/tree.h b/include/git2/tree.h index d781ea136..8d638f723 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -268,6 +268,20 @@ GIT_EXTERN(void) git_treebuilder_filter(git_treebuilder *bld, int (*filter)(cons */ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_treebuilder *bld); +/** + * Retrieve the tree object containing a tree entry, given + * a relative path to this tree entry + * + * The returned tree is owned by the repository and + * should be closed with the `git_object_close` method. + * + * @param parent_out Pointer where to store the parent tree + * @param root A previously loaded tree which will be the root of the relative path + * @param treeentry_path Path to the tree entry from which to extract the last tree object + * @return GIT_SUCCESS on success; GIT_ENOTFOUND if the path does not lead to an + * entry, GIT_EINVALIDPATH or an error code + */ +GIT_EXTERN(int) git_tree_frompath(git_tree **parent_out, git_tree *root, const char *treeentry_path); /** @} */ GIT_END_DECL #endif |