summaryrefslogtreecommitdiff
path: root/include/git2/commit.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-12 23:09:16 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-14 23:52:32 +0200
commit6b2a19418cb08e7bccefc2362f290a67555594a0 (patch)
tree44e666e45a50a59a444886b70c25c7c954d0ba4f /include/git2/commit.h
parent005718280712634486a097427212e652b0e29f36 (diff)
downloadlibgit2-6b2a19418cb08e7bccefc2362f290a67555594a0.tar.gz
Fix the retarded object interdependency system
It's no longer retarded. All object interdependencies are stored as OIDs instead of actual objects. This should be hundreds of times faster, specially on big repositories. Heck, who knows, maye it doesn't even segfault -- wouldn't that be awesome? What has changed on the API? `git_commit_parent`, `git_commit_tree`, `git_tag_target` now return their values through a pointer-to-pointer, and have an error code. `git_commit_set_tree` and `git_tag_set_target` now return an error code and may fail. `git_repository_free__no_gc` has been deprecated because it's stupid. Since there are no longer any interdependencies between objects, we don't need internal reference counting, and GC never fails or double-free's pointers. `git_object_close` now does a very sane thing: marks an object as unused. Closed objects will be eventually free'd from the object cache based on LRU. Please use `git_object_close` from the garbage collector `destroy` method on your bindings. It's 100% safe. `git_repository_gc` is a new method that forces a garbage collector pass through the repo, to free as many LRU objects as possible. This is useful if we are running out of memory.
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r--include/git2/commit.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h
index 21836dbbd..1556e52b1 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -122,10 +122,11 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
/**
* Get the tree pointed to by a commit.
+ * @param tree_out pointer where to store the tree object
* @param commit a previously loaded commit.
- * @return the tree of a commit
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(const git_tree *) git_commit_tree(git_commit *commit);
+GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
/**
* Get the number of parents of this commit
@@ -137,11 +138,13 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
/**
* Get the specified parent of the commit.
+ *
+ * @param parent Pointer where to store the parent commit
* @param commit a previously loaded commit.
- * @param n the position of the entry
- * @return a pointer to the commit; NULL if out of bounds
+ * @param n the position of the parent (from 0 to `parentcount`)
+ * @return 0 on success; error code otherwise
*/
-GIT_EXTERN(git_commit *) git_commit_parent(git_commit *commit, unsigned int n);
+GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n);
/**
* Add a new parent commit to an existing commit
@@ -176,8 +179,9 @@ GIT_EXTERN(void) git_commit_set_author(git_commit *commit, const git_signature *
* Set the tree which is pointed to by a commit
* @param commit the commit object
* @param tree the new tree
+ * @param 0 on success; error code otherwise
*/
-GIT_EXTERN(void) git_commit_set_tree(git_commit *commit, git_tree *tree);
+GIT_EXTERN(int) git_commit_set_tree(git_commit *commit, git_tree *tree);
/** @} */
GIT_END_DECL