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

Method NewNoteIterator

note.go:200–223  ·  view source on GitHub ↗

NewNoteIterator creates a new iterator for notes

(ref string)

Source from the content-addressed store, hash-verified

198
199// NewNoteIterator creates a new iterator for notes
200func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error) {
201 var cref *C.char
202 if ref == "" {
203 cref = nil
204 } else {
205 cref = C.CString(ref)
206 defer C.free(unsafe.Pointer(cref))
207 }
208
209 var ptr *C.git_note_iterator
210
211 runtime.LockOSThread()
212 defer runtime.UnlockOSThread()
213
214 ret := C.git_note_iterator_new(&ptr, repo.ptr, cref)
215 runtime.KeepAlive(repo)
216 if ret < 0 {
217 return nil, MakeGitError(ret)
218 }
219
220 iter := &NoteIterator{ptr: ptr, r: repo}
221 runtime.SetFinalizer(iter, (*NoteIterator).Free)
222 return iter, nil
223}
224
225// Free frees the note interator
226func (v *NoteIterator) Free() {

Callers 1

TestNoteIteratorFunction · 0.80

Calls 2

MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by 1

TestNoteIteratorFunction · 0.64