Merge pull request #318 from netnose/tag-remove

Tag Remove
This commit is contained in:
Carlos Martín Nieto 2016-07-06 23:54:40 +02:00 committed by GitHub
commit f720800b50
2 changed files with 16 additions and 1 deletions

View File

@ -28,7 +28,7 @@ type Repository struct {
// read, write and delete notes from this repository. // read, write and delete notes from this repository.
Notes NoteCollection Notes NoteCollection
// Tags represents the collection of tags and can be used to create, // Tags represents the collection of tags and can be used to create,
// list and iterate tags in this repository. // list, iterate and remove tags in this repository.
Tags TagsCollection Tags TagsCollection
} }

15
tag.go
View File

@ -83,6 +83,21 @@ func (c *TagsCollection) Create(
return oid, nil return oid, nil
} }
func (c *TagsCollection) Remove(name string) error {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
ret := C.git_tag_delete(c.repo.ptr, cname)
if ret < 0 {
return MakeGitError(ret)
}
return nil
}
// CreateLightweight creates a new lightweight tag pointing to a commit // CreateLightweight creates a new lightweight tag pointing to a commit
// and returns the id of the target object. // and returns the id of the target object.
// //