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

Method Read

note.go:65–86  ·  view source on GitHub ↗

Read reads the note for an object

(ref string, id *Oid)

Source from the content-addressed store, hash-verified

63
64// Read reads the note for an object
65func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error) {
66 var cref *C.char
67 if ref == "" {
68 cref = nil
69 } else {
70 cref = C.CString(ref)
71 defer C.free(unsafe.Pointer(cref))
72 }
73
74 runtime.LockOSThread()
75 defer runtime.UnlockOSThread()
76
77 var ptr *C.git_note
78 ret := C.git_note_read(&ptr, c.repo.ptr, cref, id.toC())
79 runtime.KeepAlive(c)
80 runtime.KeepAlive(id)
81 if ret < 0 {
82 return nil, MakeGitError(ret)
83 }
84
85 return newNoteFromC(ptr, c.repo), nil
86}
87
88// Remove removes the note for an object
89func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error {

Callers

nothing calls this directly

Calls 4

MakeGitErrorFunction · 0.85
newNoteFromCFunction · 0.85
freeMethod · 0.80
toCMethod · 0.45

Tested by

no test coverage detected