diff options
Diffstat (limited to 'repository/mock_repo.go')
-rw-r--r-- | repository/mock_repo.go | 17 |
1 files changed, 17 insertions, 0 deletions
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 |