Browse Source

Fire File updates disregarding the length

Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
Vadim Markovtsev 6 years ago
parent
commit
be024922c3
2 changed files with 2 additions and 2 deletions
  1. 1 1
      internal/burndown/file.go
  2. 1 1
      internal/burndown/file_test.go

+ 1 - 1
internal/burndown/file.go

@@ -61,8 +61,8 @@ func (file *File) updateTime(currentTime, previousTime, delta int) {
 // updaters are the attached interval length mappings.
 func NewFile(hash plumbing.Hash, time int, length int, updaters ...Updater) *File {
 	file := &File{Hash: hash, tree: new(rbtree.RBTree), updaters: updaters}
+	file.updateTime(time, time, length)
 	if length > 0 {
-		file.updateTime(time, time, length)
 		file.tree.Insert(rbtree.Item{Key: 0, Value: time})
 	}
 	file.tree.Insert(rbtree.Item{Key: length, Value: TreeEnd})

+ 1 - 1
internal/burndown/file_test.go

@@ -174,7 +174,7 @@ func TestZeroInitializeFile(t *testing.T) {
 	file := NewFile(plumbing.ZeroHash, 0, 0, func(a, b, c int) {
 		updateStatusFile(status, a, b, c)
 	})
-	assert.NotContains(t, status, 0)
+	assert.Contains(t, status, 0)
 	dump := file.Dump()
 	// Output:
 	// 0 -1