Beispiel #1
0
func (tree *Tree) CreateTreeBuilder() (*TreeBuilder, error) {
	builder := new(TreeBuilder)
	ecode := C.git_treebuilder_create(&builder.git_treebuilder, tree.git_tree)
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return builder, nil
}
Beispiel #2
0
func (v *Repository) TreeBuilder() (*TreeBuilder, error) {
	bld := new(TreeBuilder)
	if ret := C.git_treebuilder_create(&bld.ptr, nil); ret < 0 {
		return nil, LastError()
	}

	bld.repo = v
	return bld, nil
}
Beispiel #3
0
func (v *Repository) TreeBuilderFromTree(tree *Tree) (*TreeBuilder, error) {
	bld := new(TreeBuilder)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	if ret := C.git_treebuilder_create(&bld.ptr, tree.cast_ptr); ret < 0 {
		return nil, MakeGitError(ret)
	}
	runtime.SetFinalizer(bld, (*TreeBuilder).Free)

	bld.repo = v
	return bld, nil
}