Exemplo n.º 1
0
func (i *GitIndex) Add(file string) error {
	cfile := C.CString(file)
	defer C.free(unsafe.Pointer(cfile))

	ret := C.git_index_add_bypath(i.ptr, cfile)
	if ret < 0 {
		return GitErrorLast()
	}

	return i.Write()
}
Exemplo n.º 2
0
Arquivo: index.go Projeto: wid/git2go
func (v *Index) AddByPath(path string) error {
	cstr := C.CString(path)
	defer C.free(unsafe.Pointer(cstr))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_index_add_bypath(v.ptr, cstr)
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}