aboutsummaryrefslogtreecommitdiffstats
path: root/bug
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 /bug
parent5eaf9e83e7cd56b8bb4915193d13adfb60575b21 (diff)
downloadgit-bug-0d5998eb67f9bbf146e15a127a2d6a89aa14eab9.tar.gz
commands: add a package to handle implicit bug selection
Diffstat (limited to 'bug')
-rw-r--r--bug/bug.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/bug/bug.go b/bug/bug.go
index 98d8b2ce..83e27fa2 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -27,6 +27,8 @@ const editClockEntryPattern = "edit-clock-%d"
const idLength = 40
const humanIdLength = 7
+var ErrBugNotExist = errors.New("bug doesn't exist")
+
var _ Interface = &Bug{}
// Bug hold the data of a bug thread, organized in a way close to
@@ -106,7 +108,7 @@ func readBug(repo repository.Repo, ref string) (*Bug, error) {
hashes, err := repo.ListCommits(ref)
if err != nil {
- return nil, err
+ return nil, ErrBugNotExist
}
refSplit := strings.Split(ref, "/")
@@ -123,13 +125,12 @@ func readBug(repo repository.Repo, ref string) (*Bug, error) {
// Load each OperationPack
for _, hash := range hashes {
entries, err := repo.ListEntries(hash)
-
- bug.lastCommit = hash
-
if err != nil {
return nil, err
}
+ bug.lastCommit = hash
+
var opsEntry repository.TreeEntry
opsFound := false
var rootEntry repository.TreeEntry