aboutsummaryrefslogtreecommitdiffstats
path: root/cache/repo_cache_bug.go
diff options
context:
space:
mode:
authorvince <vincetiu8@gmail.com>2020-07-20 09:55:14 +0800
committerMichael Muré <batolettre@gmail.com>2020-07-28 14:30:05 +0200
commit4e4ca106aea25da74f1df49d33f4eaa272a6e8f0 (patch)
treea019a325fbafe1fe4ae5a834302eb6cd2e8a3f62 /cache/repo_cache_bug.go
parent36f300cb35b203310e923cf956310c7f20ed7406 (diff)
downloadgit-bug-4e4ca106aea25da74f1df49d33f4eaa272a6e8f0.tar.gz
Allow user to delete remote bugs
Diffstat (limited to 'cache/repo_cache_bug.go')
-rw-r--r--cache/repo_cache_bug.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/cache/repo_cache_bug.go b/cache/repo_cache_bug.go
index 0492e7f1..0c26cb38 100644
--- a/cache/repo_cache_bug.go
+++ b/cache/repo_cache_bug.go
@@ -361,13 +361,24 @@ func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title strin
}
// RemoveBug removes a bug from the cache and repo
-func (c *RepoCache) RemoveBug(prefix string) error {
- b, err := c.ResolveBugPrefix(prefix)
+// args[0] specifies the bug prefix to remove
+// args[1] (if present) specifies the remote the bug was imported from
+func (c *RepoCache) RemoveBug(args []string) error {
+ if len(args) == 0 {
+ return fmt.Errorf("you must provide a bug prefix to remove")
+ }
+
+ b, err := c.ResolveBugPrefix(args[0])
+
if err != nil {
return err
}
- err = bug.RemoveLocalBug(c.repo, b.Id())
+ if len(args) == 1 {
+ err = bug.RemoveLocalBug(c.repo, b.Id())
+ } else {
+ err = bug.RemoveRemoteBug(c.repo, args[1], b.Id())
+ }
if err != nil {
return err
}