aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-08-07 15:31:38 +0200
committerMichael Muré <batolettre@gmail.com>2019-08-08 19:02:46 +0200
commit2e1a5e246ee3589c2f664a62ebd06be7dc69c229 (patch)
tree03e69d6991fb4b9f9a159ba2d7b74b5f36d5069d /commands
parent2c3034a0abe13eb6b07d8dd13041e7be4adc6f93 (diff)
downloadgit-bug-2e1a5e246ee3589c2f664a62ebd06be7dc69c229.tar.gz
bug: compute op's ID based on the serialized data on disk
Diffstat (limited to 'commands')
-rw-r--r--commands/select/select.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/commands/select/select.go b/commands/select/select.go
index b080d277..4ec3cb0e 100644
--- a/commands/select/select.go
+++ b/commands/select/select.go
@@ -7,11 +7,11 @@ import (
"os"
"path"
+ "github.com/pkg/errors"
+
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/repository"
- "github.com/MichaelMure/git-bug/util/git"
- "github.com/pkg/errors"
)
const selectFile = "select"
@@ -112,8 +112,8 @@ func selected(repo *cache.RepoCache) (*cache.BugCache, error) {
return nil, fmt.Errorf("the select file should be < 100 bytes")
}
- h := git.Hash(buf)
- if !h.IsValid() {
+ id := string(buf)
+ if !bug.IDIsValid(id) {
err = os.Remove(selectPath)
if err != nil {
return nil, errors.Wrap(err, "error while removing invalid select file")
@@ -122,7 +122,7 @@ func selected(repo *cache.RepoCache) (*cache.BugCache, error) {
return nil, fmt.Errorf("select file in invalid, removing it")
}
- b, err := repo.ResolveBug(string(h))
+ b, err := repo.ResolveBug(id)
if err != nil {
return nil, err
}