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

Method AddAll

index.go:229–264  ·  view source on GitHub ↗
(pathspecs []string, flags IndexAddOption, callback IndexMatchedPathCallback)

Source from the content-addressed store, hash-verified

227}
228
229func (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
266func (v *Index) UpdateAll(pathspecs []string, callback IndexMatchedPathCallback) error {
267 cpathspecs := C.git_strarray{}

Callers 2

TestIndexAddAllCallbackFunction · 0.80

Calls 5

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

Tested by 2

TestIndexAddAllCallbackFunction · 0.64