Merge pull request #29 from Merovius/parent

Implement Parent()-functions for Commits
This commit is contained in:
Vicent Martí 2013-06-13 10:10:13 -07:00
commit 2c6cab8025
1 changed files with 17 additions and 0 deletions

View File

@ -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 {