summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <[email protected]>2013-06-13 10:10:13 -0700
committerVicent Martí <[email protected]>2013-06-13 10:10:13 -0700
commit2c6cab80256ba4ecec61a8331a3364fb7c7fcad7 (patch)
tree03ca732f4cb085894d7be0ed516fd2742a813884
parent551e580a792a1b7f7e46e25d015ff4f835a6d4db (diff)
parent543a6a87afc3ec68ba2a3af8d1046fd4dd4b6f58 (diff)
Merge pull request #29 from Merovius/parent
Implement Parent()-functions for Commits
-rw-r--r--commit.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/commit.go b/commit.go
index d31f684..06d1a22 100644
--- a/commit.go
+++ b/commit.go
@@ -53,6 +53,23 @@ func (c *Commit) Committer() *Signature {
return newSignatureFromC(ptr)
}
+func (c *Commit) Parent(n uint) *Commit {
+ par := &Commit{}
+ ret := C.git_commit_parent(&par.ptr, c.ptr, C.uint(n))
+ if ret != 0 {
+ return nil
+ }
+ return par
+}
+
+func (c *Commit) ParentId(n uint) *Oid {
+ return newOidFromC(C.git_commit_parent_id(c.ptr, C.uint(n)))
+}
+
+func (c *Commit) ParentCount() uint {
+ return uint(C.git_commit_parentcount(c.ptr))
+}
+
// Signature
type Signature struct {