Пример #1
0
func (v *Index) Add(file string) (err error) {
	s := C.CString(file)
	defer C.free(unsafe.Pointer(s))
	if C.git_index_add(v.git_index, s, 0) < GIT_SUCCESS {
		return LastError()
	}
	return
}
Пример #2
0
func (idx *Index) Add(name string, stage int) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	ecode := C.git_index_add(idx.git_index, cname, C.int(stage))
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}
Пример #3
0
// Add adds or replaces the given entry to the index, making a copy of
// the data
func (v *Index) Add(entry *IndexEntry) error {
	var centry C.git_index_entry

	populateCIndexEntry(entry, &centry)
	defer freeCIndexEntry(&centry)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	if err := C.git_index_add(v.ptr, &centry); err < 0 {
		return MakeGitError(err)
	}

	return nil
}