From 0d5998eb67f9bbf146e15a127a2d6a89aa14eab9 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 18 Sep 2018 12:49:16 +0200 Subject: commands: add a package to handle implicit bug selection --- bug/bug.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bug') 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 -- cgit