From 6a12373965aff9f80147f8b5bff6a5a104927365 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 25 Jul 2018 18:01:32 +0200 Subject: more refactoring to have reusable bug action across different UI --- repository/mock_repo.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'repository/mock_repo.go') diff --git a/repository/mock_repo.go b/repository/mock_repo.go index 4bd25738..f8653c64 100644 --- a/repository/mock_repo.go +++ b/repository/mock_repo.go @@ -3,6 +3,8 @@ package repository import ( "crypto/sha1" "fmt" + "strings" + "github.com/MichaelMure/git-bug/util" ) @@ -134,6 +136,21 @@ func (r *mockRepoForTest) ListRefs(refspec string) ([]string, error) { return keys, nil } +// ListIds will return a list of Git ref matching the given refspec, +// stripped to only the last part of the ref +func (r *mockRepoForTest) ListIds(refspec string) ([]string, error) { + keys := make([]string, len(r.refs)) + + i := 0 + for k := range r.refs { + splitted := strings.Split(k, "/") + keys[i] = splitted[len(splitted)-1] + i++ + } + + return keys, nil +} + func (r *mockRepoForTest) ListCommits(ref string) ([]util.Hash, error) { var hashes []util.Hash -- cgit