[#335] treesvc: Fix inmemory unit tests and nil meta items

Bolt forest saves empty slice of items. Now inmemory forest
does it the same way.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-07-13 11:50:13 +03:00
parent b4e72a2dfd
commit af82c2865e
2 changed files with 19 additions and 8 deletions

View file

@ -68,10 +68,14 @@ func (s *memoryTree) Apply(op *Move) error {
// do performs a single move operation on a tree.
func (s *memoryTree) do(op *Move) move {
m := op.Meta
if m.Items == nil {
m.Items = []KeyValue{}
}
lm := move{
Move: Move{
Parent: op.Parent,
Meta: op.Meta,
Meta: m,
Child: op.Child,
},
}
@ -91,7 +95,7 @@ func (s *memoryTree) do(op *Move) move {
p.Meta.Time = op.Time
}
p.Meta = op.Meta
p.Meta = m
p.Parent = op.Parent
s.tree.infoMap[op.Child] = p