summaryrefslogtreecommitdiff
path: root/include/git2/tree.h
diff options
context:
space:
mode:
authorVicent Martí <tanoku@gmail.com>2011-06-06 18:31:21 -0700
committerVicent Martí <tanoku@gmail.com>2011-06-06 18:31:21 -0700
commit9b1692ebfcc4b91e8171d0614530133ac2b032e1 (patch)
treecae5ef6870569cb376494f0f08aece894e31ca35 /include/git2/tree.h
parent1b0d92b141a784663a34cf8dec4242c471586429 (diff)
parent790c6c95fe12051f7f7b32df5f4fba316872fddb (diff)
downloadlibgit2-9b1692ebfcc4b91e8171d0614530133ac2b032e1.tar.gz
Merge pull request #239 from pegonma/oid_prefix
Search objects of different types given OID prefix
Diffstat (limited to 'include/git2/tree.h')
-rw-r--r--include/git2/tree.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/git2/tree.h b/include/git2/tree.h
index 2a4522b3c..a98d2d6e8 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -53,6 +53,23 @@ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git
}
/**
+ * Lookup a tree object from the repository,
+ * given a prefix of its identifier (short id).
+ *
+ * @see git_object_lookup_prefix
+ *
+ * @param tree pointer to the looked up tree
+ * @param repo the repo to use when locating the tree.
+ * @param id identity of the tree to locate.
+ * @param len the length of the short identifier
+ * @return 0 on success; error code otherwise
+ */
+GIT_INLINE(int) git_tree_lookup_prefix(git_tree **tree, git_repository *repo, const git_oid *id, unsigned int len)
+{
+ return git_object_lookup_prefix((git_object **)tree, repo, id, len, GIT_OBJ_TREE);
+}
+
+/**
* Close an open tree
*
* This is a wrapper around git_object_close()