Beispiel #1
0
// Tree returns the tree pointed by the commit.
func (c *Commit) Tree() (*Tree, error) {
	t := new(Tree)
	if C.git_commit_tree(&t.tree, c.commit) != C.GIT_OK {
		return nil, lastErr()
	}
	return t, nil
}
Beispiel #2
0
func (commit *Commit) Tree() (*Tree, error) {
	tree := new(Tree)
	ecode := C.git_commit_tree(&tree.git_tree, commit.git_commit)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return tree, nil
}
Beispiel #3
0
func TreeFromCommit(repo *Repo, commit *Commit) (*Tree, error) {
	tree := new(Tree)
	ecode := C.git_commit_tree(&tree.git_tree, commit.git_commit)
	if ecode < GIT_SUCCESS {
		return nil, LastError()
	}
	return tree, nil
}
Beispiel #4
0
func (c Commit) Tree() (*Tree, error) {
	var ptr *C.git_object

	err := C.git_commit_tree(&ptr, c.ptr)
	if err < 0 {
		return nil, LastError()
	}

	return allocObject(ptr).(*Tree), nil
}
Beispiel #5
0
func (c *Commit) Tree() (*Tree, error) {
	tree := new(Tree)

	err := C.git_commit_tree(&tree.ptr, c.ptr)
	if err < 0 {
		return nil, LastError()
	}

	runtime.SetFinalizer(tree, (*Tree).Free)
	return tree, nil
}
Beispiel #6
0
func (c Commit) Tree() (*Tree, error) {
	var ptr *C.git_tree

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	err := C.git_commit_tree(&ptr, c.cast_ptr)
	if err < 0 {
		return nil, MakeGitError(err)
	}

	return allocObject((*C.git_object)(ptr), c.repo).(*Tree), nil
}