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

Method Remove

note.go:89–120  ·  view source on GitHub ↗

Remove removes the note for an object

(ref string, author, committer *Signature, id *Oid)

Source from the content-addressed store, hash-verified

87
88// Remove removes the note for an object
89func (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
123func (c *NoteCollection) DefaultRef() (string, error) {

Callers

nothing calls this directly

Calls 3

MakeGitErrorFunction · 0.85
freeMethod · 0.80
toCMethod · 0.45

Tested by

no test coverage detected