summaryrefslogtreecommitdiff
path: root/include/git2/commit.h
diff options
context:
space:
mode:
authorSam <sam.c.day@gmail.com>2011-04-06 10:48:31 +1000
committerVicent Marti <tanoku@gmail.com>2011-04-08 03:33:46 +0300
commit5924b2822cf0d7edad3f68573950d139dfcaaf06 (patch)
tree9fef60db1e9197304b46d76c8a15208e4f23d5ba /include/git2/commit.h
parent98ac67808559e8c2238a855feb6fedfc4b956984 (diff)
downloadlibgit2-5924b2822cf0d7edad3f68573950d139dfcaaf06.tar.gz
Added git_commit_tree_oid and git_commit_parent_oid.
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r--include/git2/commit.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h
index c09b3484..3687d946 100644
--- a/include/git2/commit.h
+++ b/include/git2/commit.h
@@ -136,6 +136,16 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
/**
+ * Get the id of the tree pointed to by a commit. This differs from
+ * `git_commit_tree` in that no attempts are made to fetch an object
+ * from the ODB.
+ *
+ * @param commit a previously loaded commit.
+ * @return the id of tree pointed to by commit.
+ */
+GIT_EXTERN(const git_oid *) git_commit_tree_oid(git_commit *commit);
+
+/**
* Get the number of parents of this commit
*
* @param commit a previously loaded commit.
@@ -153,6 +163,16 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
*/
GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n);
+/**
+ * Get the oid of a specified parent for a commit. This is different from
+ * `git_commit_parent`, which will attempt to load the parent commit from
+ * the ODB.
+ *
+ * @param commit a previously loaded commit.
+ * @param n the position of the parent (from 0 to `parentcount`)
+ * @return the id of the parent, NULL on error.
+ */
+GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned int n);
/**
* Create a new commit in the repository