func (repo *Repository) ReadNote(ref string, oid *Oid) (*Note, error) { note := new(Note) cref := C.CString(ref) defer C.free(unsafe.Pointer(cref)) ecode := C.git_note_read(¬e.git_note, repo.git_repository, cref, oid.git_oid) if ecode != git_SUCCESS { return nil, gitError() } return note, nil }
// Read reads the note for an object func (c *NoteCollection) Read(ref string, id *Oid) (*Note, error) { var cref *C.char if ref == "" { cref = nil } else { cref = C.CString(ref) defer C.free(unsafe.Pointer(cref)) } note := new(Note) runtime.LockOSThread() defer runtime.UnlockOSThread() if ret := C.git_note_read(¬e.ptr, c.repo.ptr, cref, id.toC()); ret < 0 { return nil, MakeGitError(ret) } runtime.SetFinalizer(note, (*Note).Free) return note, nil }