diff options
author | vince <vincetiu8@gmail.com> | 2020-11-19 20:57:57 +0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-11-22 15:20:51 +0100 |
commit | 647b05eee4b612f33a2f22576821ea1c012d7c84 (patch) | |
tree | 8e9e7d95f1238678e528d9a302936107a0766de7 /bug/bug.go | |
parent | 25b0c71948fe4bf5b4f4b8ca91ffc4d2f8c47643 (diff) | |
download | git-bug-647b05eee4b612f33a2f22576821ea1c012d7c84.tar.gz |
add remove identity feature
also adds:
- listlocalidentities
- refactors refstoids into entity package
Diffstat (limited to 'bug/bug.go')
-rw-r--r-- | bug/bug.go | 21 |
1 files changed, 3 insertions, 18 deletions
@@ -234,7 +234,7 @@ func RemoveBug(repo repository.ClockedRepo, id entity.Id) error { return err } if len(refs) > 1 { - return NewErrMultipleMatchBug(refsToIds(refs)) + return NewErrMultipleMatchBug(entity.RefsToIds(refs)) } if len(refs) == 1 { // we have the bug locally @@ -253,7 +253,7 @@ func RemoveBug(repo repository.ClockedRepo, id entity.Id) error { return err } if len(remoteRefs) > 1 { - return NewErrMultipleMatchBug(refsToIds(refs)) + return NewErrMultipleMatchBug(entity.RefsToIds(refs)) } if len(remoteRefs) == 1 { // found the bug in a remote @@ -337,22 +337,7 @@ func ListLocalIds(repo repository.Repo) ([]entity.Id, error) { return nil, err } - return refsToIds(refs), nil -} - -func refsToIds(refs []string) []entity.Id { - ids := make([]entity.Id, len(refs)) - - for i, ref := range refs { - ids[i] = refToId(ref) - } - - return ids -} - -func refToId(ref string) entity.Id { - split := strings.Split(ref, "/") - return entity.Id(split[len(split)-1]) + return entity.RefsToIds(refs), nil } // Validate check if the Bug data is valid |