summaryrefslogtreecommitdiff
path: root/src/git/tree.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-06-18 13:06:34 +0200
committerVicent Marti <tanoku@gmail.com>2010-07-15 23:39:30 +0200
commit225fe21522a98075bdc18dae90ce459f797ac366 (patch)
tree16d9bd5394fcbe6cc3dd5cae5124bd8400343e10 /src/git/tree.h
parent40721f6b1297f2a48aeb5c9a3ac095767b1153bf (diff)
downloadlibgit2-225fe21522a98075bdc18dae90ce459f797ac366.tar.gz
Add support for tree objects in revision pools
Commits now store pointers to their tree objects. Tree objects now work as separate git_revpool_object entities. Tree objects can be loaded and parsed inedependently from commits. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git/tree.h')
-rw-r--r--src/git/tree.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/git/tree.h b/src/git/tree.h
new file mode 100644
index 000000000..d5f668c54
--- /dev/null
+++ b/src/git/tree.h
@@ -0,0 +1,39 @@
+#ifndef INCLUDE_git_tree_h__
+#define INCLUDE_git_tree_h__
+
+#include "common.h"
+#include "oid.h"
+
+/**
+ * @file git/tree.h
+ * @brief Git tree parsing, loading routines
+ * @defgroup git_tree Git tree parsing, loading routines
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/** Representation of a tree object. */
+typedef struct git_tree git_tree;
+
+/**
+ * Locate a reference to a tree without loading it.
+ * The generated tree object is owned by the revision
+ * pool and shall not be freed by the user.
+ *
+ * @param pool the pool to use when locating the tree.
+ * @param id identity of the tree to locate.
+ * @return the tree; NULL if the tree could not be created
+ */
+GIT_EXTERN(git_tree *) git_tree_lookup(git_revpool *pool, const git_oid *id);
+
+/**
+ * Get the id of a tree.
+ * @param tree a previously loaded tree.
+ * @return object identity for the tree.
+ */
+GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree);
+
+/** @} */
+GIT_END_DECL
+#endif