From 2e1a5e246ee3589c2f664a62ebd06be7dc69c229 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 7 Aug 2019 15:31:38 +0200 Subject: bug: compute op's ID based on the serialized data on disk --- bug/op_create.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'bug/op_create.go') diff --git a/bug/op_create.go b/bug/op_create.go index e52e6254..e3d0a63a 100644 --- a/bug/op_create.go +++ b/bug/op_create.go @@ -25,25 +25,18 @@ func (op *CreateOperation) base() *OpBase { return &op.OpBase } -func (op *CreateOperation) Hash() (git.Hash, error) { - return hashOperation(op) +func (op *CreateOperation) ID() string { + return idOperation(op) } func (op *CreateOperation) Apply(snapshot *Snapshot) { snapshot.addActor(op.Author) snapshot.addParticipant(op.Author) - hash, err := op.Hash() - if err != nil { - // Should never error unless a programming error happened - // (covered in OpBase.Validate()) - panic(err) - } - snapshot.Title = op.Title comment := Comment{ - id: string(hash), + id: op.ID(), Message: op.Message, Author: op.Author, UnixTime: timestamp.Timestamp(op.UnixTime), @@ -55,7 +48,7 @@ func (op *CreateOperation) Apply(snapshot *Snapshot) { snapshot.Timeline = []TimelineItem{ &CreateTimelineItem{ - CommentTimelineItem: NewCommentTimelineItem(hash, comment), + CommentTimelineItem: NewCommentTimelineItem(op.ID(), comment), }, } } -- cgit