aboutsummaryrefslogtreecommitdiffstats
path: root/bug/op_create.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-11-30 00:41:50 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:17:49 +0100
commitfcf43915e1736fe0b56f8f06386f68d9b56da7a8 (patch)
treee85beec4672a8a4792317323ac33a2df8ad40f98 /bug/op_create.go
parentd96284da646cc1d3e3d7d3b2f7a1ab0e8e7a4d88 (diff)
downloadgit-bug-fcf43915e1736fe0b56f8f06386f68d9b56da7a8.tar.gz
bug: fix tests
Diffstat (limited to 'bug/op_create.go')
-rw-r--r--bug/op_create.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/bug/op_create.go b/bug/op_create.go
index 15fb69b5..044ddd72 100644
--- a/bug/op_create.go
+++ b/bug/op_create.go
@@ -54,6 +54,13 @@ func (op *CreateOperation) SetMetadata(key string, value string) {
}
func (op *CreateOperation) Apply(snapshot *Snapshot) {
+ // sanity check: will fail when adding a second Create
+ if snapshot.id != "" && snapshot.id != entity.UnsetId && snapshot.id != op.Id() {
+ panic("adding a second Create operation")
+ }
+
+ snapshot.id = op.Id()
+
snapshot.addActor(op.Author)
snapshot.addParticipant(op.Author)