aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-18 12:49:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-18 12:49:16 +0200
commit0d5998eb67f9bbf146e15a127a2d6a89aa14eab9 (patch)
tree1f9a61040bc5f84ef2b78199a9adf922b7f0441f /cache
parent5eaf9e83e7cd56b8bb4915193d13adfb60575b21 (diff)
downloadgit-bug-0d5998eb67f9bbf146e15a127a2d6a89aa14eab9.tar.gz
commands: add a package to handle implicit bug selection
Diffstat (limited to 'cache')
-rw-r--r--cache/bug_cache.go4
-rw-r--r--cache/repo_cache.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index b0dbb6cc..4fdc7d62 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -22,6 +22,10 @@ func (c *BugCache) Snapshot() *bug.Snapshot {
return c.bug.Snapshot()
}
+func (c *BugCache) Id() string {
+ return c.bug.Id()
+}
+
func (c *BugCache) HumanId() string {
return c.bug.HumanId()
}
diff --git a/cache/repo_cache.go b/cache/repo_cache.go
index ce7630a3..720857ce 100644
--- a/cache/repo_cache.go
+++ b/cache/repo_cache.go
@@ -207,6 +207,10 @@ func (c *RepoCache) ResolveBugPrefix(prefix string) (*BugCache, error) {
return nil, fmt.Errorf("Multiple matching bug found:\n%s", strings.Join(matching, "\n"))
}
+ if len(matching) == 0 {
+ return nil, bug.ErrBugNotExist
+ }
+
return c.ResolveBug(matching[0])
}