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 }
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 }
// 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, ¢ry) defer freeCIndexEntry(¢ry) runtime.LockOSThread() defer runtime.UnlockOSThread() if err := C.git_index_add(v.ptr, ¢ry); err < 0 { return MakeGitError(err) } return nil }