Merge pull request #318 from netnose/tag-remove
Tag Remove
diff --git a/repository.go b/repository.go
index 77e9f9c..efc506e 100644
--- a/repository.go
+++ b/repository.go
@@ -28,7 +28,7 @@
// read, write and delete notes from this repository.
Notes NoteCollection
// 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
}
diff --git a/tag.go b/tag.go
index 8957430..81d7258 100644
--- a/tag.go
+++ b/tag.go
@@ -83,6 +83,21 @@
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
// and returns the id of the target object.
//