| 300 | } |
| 301 | |
| 302 | func (v *Index) RemoveAll(pathspecs []string, callback IndexMatchedPathCallback) error { |
| 303 | cpathspecs := C.git_strarray{} |
| 304 | cpathspecs.count = C.size_t(len(pathspecs)) |
| 305 | cpathspecs.strings = makeCStringsFromStrings(pathspecs) |
| 306 | defer freeStrarray(&cpathspecs) |
| 307 | |
| 308 | var err error |
| 309 | data := indexMatchedPathCallbackData{ |
| 310 | callback: callback, |
| 311 | errorTarget: &err, |
| 312 | } |
| 313 | runtime.LockOSThread() |
| 314 | defer runtime.UnlockOSThread() |
| 315 | |
| 316 | var handle unsafe.Pointer |
| 317 | if callback != nil { |
| 318 | handle = pointerHandles.Track(&data) |
| 319 | defer pointerHandles.Untrack(handle) |
| 320 | } |
| 321 | |
| 322 | ret := C._go_git_index_remove_all( |
| 323 | v.ptr, |
| 324 | &cpathspecs, |
| 325 | handle, |
| 326 | ) |
| 327 | runtime.KeepAlive(v) |
| 328 | if ret == C.int(ErrorCodeUser) && err != nil { |
| 329 | return err |
| 330 | } |
| 331 | if ret < 0 { |
| 332 | return MakeGitError(ret) |
| 333 | } |
| 334 | |
| 335 | return nil |
| 336 | } |
| 337 | |
| 338 | //export indexMatchedPathCallback |
| 339 | func indexMatchedPathCallback(cPath, cMatchedPathspec *C.char, payload unsafe.Pointer) C.int { |