Remove removes the note for an object
(ref string, author, committer *Signature, id *Oid)
| 87 | |
| 88 | // Remove removes the note for an object |
| 89 | func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error { |
| 90 | var cref *C.char |
| 91 | if ref == "" { |
| 92 | cref = nil |
| 93 | } else { |
| 94 | cref = C.CString(ref) |
| 95 | defer C.free(unsafe.Pointer(cref)) |
| 96 | } |
| 97 | |
| 98 | authorSig, err := author.toC() |
| 99 | if err != nil { |
| 100 | return err |
| 101 | } |
| 102 | defer C.git_signature_free(authorSig) |
| 103 | |
| 104 | committerSig, err := committer.toC() |
| 105 | if err != nil { |
| 106 | return err |
| 107 | } |
| 108 | defer C.git_signature_free(committerSig) |
| 109 | |
| 110 | runtime.LockOSThread() |
| 111 | defer runtime.UnlockOSThread() |
| 112 | |
| 113 | ret := C.git_note_remove(c.repo.ptr, cref, authorSig, committerSig, id.toC()) |
| 114 | runtime.KeepAlive(c) |
| 115 | runtime.KeepAlive(id) |
| 116 | if ret < 0 { |
| 117 | return MakeGitError(ret) |
| 118 | } |
| 119 | return nil |
| 120 | } |
| 121 | |
| 122 | // DefaultRef returns the default notes reference for a repository |
| 123 | func (c *NoteCollection) DefaultRef() (string, error) { |
nothing calls this directly
no test coverage detected