libgit2

git_tree_get_subtree

Version:

Retrieve a subtree contained in a tree, given its relative path.

The returned tree is owned by the repository and should be closed with the git_object_free method.

Signature

int git_tree_get_subtree(git_tree **subtree, git_tree *root, const char *subtree_path);

Parameters

In
subtree

Pointer where to store the subtree

In
root

A previously loaded tree which will be the root of the relative path

const char *
In
subtree_path

Path to the contained subtree

Returns

int

0 on success; GIT_ENOTFOUND if the path does not lead to a subtree

Versions