Example #1
0
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
}
Example #2
0
func (commit *Commit) Parent(n uint) (*Commit, error) {
	parent := new(Commit)
	ecode := C.git_commit_parent(&parent.git_commit, commit.git_commit, C.uint(n))
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return parent, nil
}
Example #3
0
func (c *Commit) Parent(n uint) *Commit {
	var cobj *C.git_commit
	ret := C.git_commit_parent(&cobj, c.cast_ptr, C.uint(n))
	if ret != 0 {
		return nil
	}

	return allocObject((*C.git_object)(cobj), c.repo).(*Commit)
}
Example #4
0
func (c *Commit) Parent(n uint) *Commit {
	var cobj *C.git_commit
	ret := C.git_commit_parent(&cobj, c.cast_ptr, C.uint(n))
	if ret != 0 {
		return nil
	}

	return allocCommit(cobj, c.repo)
}