Exemple #1
0
func (builder *TreeBuilder) Insert(filename string, id *Oid, attributes FileMode) (*TreeEntry, error) {
	entry := new(TreeEntry)
	cfilename := C.CString(filename)
	defer C.free(unsafe.Pointer(cfilename))
	ecode := C.git_treebuilder_insert(&entry.git_tree_entry, builder.git_treebuilder, cfilename, id.git_oid, C.uint(attributes))
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return entry, nil
}
Exemple #2
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
}
Exemple #3
0
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
}