diff options
author | Michael Muré <batolettre@gmail.com> | 2019-08-07 15:31:38 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-08-08 19:02:46 +0200 |
commit | 2e1a5e246ee3589c2f664a62ebd06be7dc69c229 (patch) | |
tree | 03e69d6991fb4b9f9a159ba2d7b74b5f36d5069d /bug/op_label_change.go | |
parent | 2c3034a0abe13eb6b07d8dd13041e7be4adc6f93 (diff) | |
download | git-bug-2e1a5e246ee3589c2f664a62ebd06be7dc69c229.tar.gz |
bug: compute op's ID based on the serialized data on disk
Diffstat (limited to 'bug/op_label_change.go')
-rw-r--r-- | bug/op_label_change.go | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/bug/op_label_change.go b/bug/op_label_change.go index 4c019d67..5afcceb7 100644 --- a/bug/op_label_change.go +++ b/bug/op_label_change.go @@ -5,11 +5,10 @@ import ( "fmt" "sort" + "github.com/pkg/errors" + "github.com/MichaelMure/git-bug/identity" "github.com/MichaelMure/git-bug/util/timestamp" - - "github.com/MichaelMure/git-bug/util/git" - "github.com/pkg/errors" ) var _ Operation = &LabelChangeOperation{} @@ -25,8 +24,8 @@ func (op *LabelChangeOperation) base() *OpBase { return &op.OpBase } -func (op *LabelChangeOperation) Hash() (git.Hash, error) { - return hashOperation(op) +func (op *LabelChangeOperation) ID() string { + return idOperation(op) } // Apply apply the operation @@ -61,15 +60,8 @@ AddLoop: return string(snapshot.Labels[i]) < string(snapshot.Labels[j]) }) - hash, err := op.Hash() - if err != nil { - // Should never error unless a programming error happened - // (covered in OpBase.Validate()) - panic(err) - } - item := &LabelChangeTimelineItem{ - hash: hash, + id: op.ID(), Author: op.Author, UnixTime: timestamp.Timestamp(op.UnixTime), Added: op.Added, @@ -163,15 +155,15 @@ func NewLabelChangeOperation(author identity.Interface, unixTime int64, added, r } type LabelChangeTimelineItem struct { - hash git.Hash + id string Author identity.Interface UnixTime timestamp.Timestamp Added []Label Removed []Label } -func (l LabelChangeTimelineItem) Hash() git.Hash { - return l.hash +func (l LabelChangeTimelineItem) ID() string { + return l.id } // Sign post method for gqlgen |