MCPcopy Create free account
hub / github.com/libgit2/git2go / RemoveAll

Method RemoveAll

index.go:302–336  ·  view source on GitHub ↗
(pathspecs []string, callback IndexMatchedPathCallback)

Source from the content-addressed store, hash-verified

300}
301
302func (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
339func indexMatchedPathCallback(cPath, cMatchedPathspec *C.char, payload unsafe.Pointer) C.int {

Callers 4

TestIndexerOutOfOrderFunction · 0.80
cleanupTestRepoFunction · 0.80
TestOdbBackendLooseFunction · 0.80

Calls 5

makeCStringsFromStringsFunction · 0.85
freeStrarrayFunction · 0.85
MakeGitErrorFunction · 0.85
TrackMethod · 0.80
UntrackMethod · 0.80

Tested by 4

TestIndexerOutOfOrderFunction · 0.64
cleanupTestRepoFunction · 0.64
TestOdbBackendLooseFunction · 0.64