aboutsummaryrefslogtreecommitdiffstats
path: root/cache/repo_cache.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-11 17:11:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-11 17:11:16 +0200
commitd1c5015eed4cfc8db19b17bd4a67e2c12b6cd8ff (patch)
tree1e195a460467845df337dc99baee7e7f980af935 /cache/repo_cache.go
parent2dcd06d1e722a81d00fd7f9ef0a62c72b20fac6b (diff)
downloadgit-bug-d1c5015eed4cfc8db19b17bd4a67e2c12b6cd8ff.tar.gz
cache: resolved id by prefix using the cache instead of reading bugs
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r--cache/repo_cache.go20
1 files changed, 2 insertions, 18 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index f0c9ac4a..a46e3a75 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -179,33 +179,17 @@ func (c *RepoCache) ResolveBugPrefix(prefix string) (*BugCache, error) {
// preallocate but empty
matching := make([]string, 0, 5)
- for id := range c.bugs {
+ for id := range c.excerpts {
if strings.HasPrefix(id, prefix) {
matching = append(matching, id)
}
}
- // TODO: should check matching bug in the repo as well
-
if len(matching) > 1 {
return nil, fmt.Errorf("Multiple matching bug found:\n%s", strings.Join(matching, "\n"))
}
- if len(matching) == 1 {
- b := c.bugs[matching[0]]
- return b, nil
- }
-
- b, err := bug.FindLocalBug(c.repo, prefix)
-
- if err != nil {
- return nil, err
- }
-
- cached := NewBugCache(c, b)
- c.bugs[b.Id()] = cached
-
- return cached, nil
+ return c.ResolveBug(matching[0])
}
func (c *RepoCache) QueryBugs(query *Query) []string {