summaryrefslogtreecommitdiff
path: root/src/git/commit.h
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/git/commit.h
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/git/commit.h')
-rw-r--r--src/git/commit.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/git/commit.h b/src/git/commit.h
index 4387925da..a584273a1 100644
--- a/src/git/commit.h
+++ b/src/git/commit.h
@@ -30,6 +30,18 @@ typedef struct git_commit git_commit;
*/
GIT_EXTERN(git_commit *) git_commit_lookup(git_repository *repo, const git_oid *id);
+/*
+ * Create a new in-memory git_commit.
+ *
+ * The commit object must be manually filled using
+ * setter methods before it can be written to its
+ * repository.
+ *
+ * @param repo The repository where the object will reside
+ * @return the object if creation was posible; NULL otherwise
+ */
+GIT_EXTERN(git_commit *) git_commit_new(git_repository *repo);
+
/**
* Get the id of a commit.
* @param commit a previously loaded commit.