diff options
author | Vicent Marti <tanoku@gmail.com> | 2010-09-20 21:39:11 +0300 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2010-09-20 21:39:11 +0300 |
commit | d45b4a9a1bcbb157a4f02cf5ed23fde5222db9c8 (patch) | |
tree | 554847491982e4256559938b1dab33730b2cffcb /src/tree.c | |
parent | 0c3596f18a6f07d8a61f8d6e2fd730a276a51599 (diff) | |
download | libgit2-d45b4a9a1bcbb157a4f02cf5ed23fde5222db9c8.tar.gz |
Add support for in-memory objects
All repository objects can now be created from scratch in memory using
either the git_object_new() method, or the corresponding git_XXX_new()
for each object.
So far, only git_commits can be written back to disk once created in
memory.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/tree.c')
-rw-r--r-- | src/tree.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tree.c b/src/tree.c index f1c191c32..670f99838 100644 --- a/src/tree.c +++ b/src/tree.c @@ -40,9 +40,14 @@ void git_tree__free(git_tree *tree) free(tree); } -const git_oid *git_tree_id(git_tree *tree) +git_tree *git_tree_new(git_repository *repo) { - return &tree->object.id; + return (git_tree *)git_object_new(repo, GIT_OBJ_TREE); +} + +const git_oid *git_tree_id(git_tree *c) +{ + return git_object_id((git_object *)c); } git_tree *git_tree_lookup(git_repository *repo, const git_oid *id) |