Exemplo n.º 1
0
Arquivo: note.go Projeto: wid/git2go
// Remove removes the note for an object
func (c *NoteCollection) Remove(ref string, author, committer *Signature, id *Oid) error {
	var cref *C.char
	if ref == "" {
		cref = nil
	} else {
		cref = C.CString(ref)
		defer C.free(unsafe.Pointer(cref))
	}

	authorSig, err := author.toC()
	if err != nil {
		return err
	}
	defer C.git_signature_free(authorSig)

	committerSig, err := committer.toC()
	if err != nil {
		return err
	}
	defer C.git_signature_free(committerSig)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_note_remove(c.repo.ptr, cref, authorSig, committerSig, id.toC())
	if ret < 0 {
		return MakeGitError(ret)
	}
	return nil
}
Exemplo n.º 2
0
func (repo *Repository) RemoveNote(ref string, author, committer *Signature, oid *Oid) error {
	cref := C.CString(ref)
	defer C.free(unsafe.Pointer(cref))
	ecode := C.git_note_remove(repo.git_repository, cref, author.git_signature, committer.git_signature, oid.git_oid)
	if ecode != git_SUCCESS {
		return gitError()
	}
	return nil
}