| 227 | } |
| 228 | |
| 229 | func (v *Index) AddAll(pathspecs []string, flags IndexAddOption, callback IndexMatchedPathCallback) error { |
| 230 | cpathspecs := C.git_strarray{} |
| 231 | cpathspecs.count = C.size_t(len(pathspecs)) |
| 232 | cpathspecs.strings = makeCStringsFromStrings(pathspecs) |
| 233 | defer freeStrarray(&cpathspecs) |
| 234 | |
| 235 | var err error |
| 236 | data := indexMatchedPathCallbackData{ |
| 237 | callback: callback, |
| 238 | errorTarget: &err, |
| 239 | } |
| 240 | runtime.LockOSThread() |
| 241 | defer runtime.UnlockOSThread() |
| 242 | |
| 243 | var handle unsafe.Pointer |
| 244 | if callback != nil { |
| 245 | handle = pointerHandles.Track(&data) |
| 246 | defer pointerHandles.Untrack(handle) |
| 247 | } |
| 248 | |
| 249 | ret := C._go_git_index_add_all( |
| 250 | v.ptr, |
| 251 | &cpathspecs, |
| 252 | C.uint(flags), |
| 253 | handle, |
| 254 | ) |
| 255 | runtime.KeepAlive(v) |
| 256 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 257 | return err |
| 258 | } |
| 259 | if ret < 0 { |
| 260 | return MakeGitError(ret) |
| 261 | } |
| 262 | |
| 263 | return nil |
| 264 | } |
| 265 | |
| 266 | func (v *Index) UpdateAll(pathspecs []string, callback IndexMatchedPathCallback) error { |
| 267 | cpathspecs := C.git_strarray{} |