diff options
author | vince <vincetiu8@gmail.com> | 2020-07-16 17:12:48 +0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-07-28 14:30:05 +0200 |
commit | 36f300cb35b203310e923cf956310c7f20ed7406 (patch) | |
tree | 5e11d662b8187309209d2fc246d1bc7bfff12048 /cache | |
parent | 0590de9f045c2090d72655a7c2e1d41be9b9104c (diff) | |
download | git-bug-36f300cb35b203310e923cf956310c7f20ed7406.tar.gz |
Add the 'rm' command
This commit adds a command that removes a bug from the repository, given a prefix.
Diffstat (limited to 'cache')
-rw-r--r-- | cache/repo_cache_bug.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cache/repo_cache_bug.go b/cache/repo_cache_bug.go index 30692363..0492e7f1 100644 --- a/cache/repo_cache_bug.go +++ b/cache/repo_cache_bug.go @@ -359,3 +359,21 @@ func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title strin return cached, op, nil } + +// RemoveBug removes a bug from the cache and repo +func (c *RepoCache) RemoveBug(prefix string) error { + b, err := c.ResolveBugPrefix(prefix) + if err != nil { + return err + } + + err = bug.RemoveLocalBug(c.repo, b.Id()) + if err != nil { + return err + } + + delete(c.bugs, b.Id()) + delete(c.bugExcerpts, b.Id()) + + return c.writeBugCache() +} |