summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-09-20 21:39:11 +0300
committerVicent Marti <tanoku@gmail.com>2010-09-20 21:39:11 +0300
commitd45b4a9a1bcbb157a4f02cf5ed23fde5222db9c8 (patch)
tree554847491982e4256559938b1dab33730b2cffcb /src/commit.c
parent0c3596f18a6f07d8a61f8d6e2fd730a276a51599 (diff)
downloadlibgit2-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/commit.c')
-rw-r--r--src/commit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/commit.c b/src/commit.c
index 7cb8f24f..90a30e02 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -63,9 +63,14 @@ void git_commit__free(git_commit *commit)
free(commit);
}
+git_commit *git_commit_new(git_repository *repo)
+{
+ return (git_commit *)git_object_new(repo, GIT_OBJ_COMMIT);
+}
+
const git_oid *git_commit_id(git_commit *c)
{
- return &c->object.id;
+ return git_object_id((git_object *)c);
}
int git_commit__parse(git_commit *commit)