Add adds or replaces the given entry to the index, making a copy of the data
(entry *IndexEntry)
| 171 | // Add adds or replaces the given entry to the index, making a copy of |
| 172 | // the data |
| 173 | func (v *Index) Add(entry *IndexEntry) error { |
| 174 | var centry C.git_index_entry |
| 175 | |
| 176 | populateCIndexEntry(entry, ¢ry) |
| 177 | defer freeCIndexEntry(¢ry) |
| 178 | |
| 179 | runtime.LockOSThread() |
| 180 | defer runtime.UnlockOSThread() |
| 181 | |
| 182 | err := C.git_index_add(v.ptr, ¢ry) |
| 183 | runtime.KeepAlive(v) |
| 184 | if err < 0 { |
| 185 | return MakeGitError(err) |
| 186 | } |
| 187 | |
| 188 | return nil |
| 189 | } |
| 190 | |
| 191 | func (v *Index) AddByPath(path string) error { |
| 192 | cstr := C.CString(path) |