示例#1
0
func (v *TreeBuilder) Insert(filename string, id *Oid, filemode int) error {
	cfilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cfilename))

	err := C.git_treebuilder_insert(nil, v.ptr, cfilename, id.toC(), C.git_filemode_t(filemode))
	if err < 0 {
		return LastError()
	}

	return nil
}
示例#2
0
文件: tree.go 项目: kissthink/git2go
func (v *TreeBuilder) Insert(filename string, id *Oid, filemode int) error {
	cfilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cfilename))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	err := C.git_treebuilder_insert(nil, v.ptr, cfilename, id.toC(), C.git_filemode_t(filemode))
	if err < 0 {
		return MakeGitError(err)
	}

	return nil
}