diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-19 13:58:55 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-19 13:58:55 +0200 |
commit | b58812136e404434ac01612cb4a573881f45eb55 (patch) | |
tree | 5039d3bc82190f3b4a836950d742ccb781917542 /bug | |
parent | 71523f23edcb02a94061941b45f24a1f1ea4231b (diff) | |
download | git-bug-b58812136e404434ac01612cb4a573881f45eb55.tar.gz |
bug: remove use of the too recent %(refname:lstrip=-1) of git
fix #24
Diffstat (limited to 'bug')
-rw-r--r-- | bug/bug.go | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -58,7 +58,7 @@ func NewBug() *Bug { // FindLocalBug find an existing Bug matching a prefix func FindLocalBug(repo repository.Repo, prefix string) (*Bug, error) { - ids, err := repo.ListIds(bugsRefPattern) + ids, err := ListLocalIds(repo) if err != nil { return nil, err @@ -255,7 +255,23 @@ func readAllBugs(repo repository.Repo, refPrefix string) <-chan StreamedBug { // ListLocalIds list all the available local bug ids func ListLocalIds(repo repository.Repo) ([]string, error) { - return repo.ListIds(bugsRefPattern) + refs, err := repo.ListRefs(bugsRefPattern) + if err != nil { + return nil, err + } + + return refsToIds(refs), nil +} + +func refsToIds(refs []string) []string { + ids := make([]string, len(refs)) + + for i, ref := range refs { + splitted := strings.Split(ref, "/") + ids[i] = splitted[len(splitted)-1] + } + + return ids } // IsValid check if the Bug data is valid |