From 4b1a2caea744083ac685fee7e67330dc70b3c4df Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 25 Oct 2015 15:05:22 +0100 Subject: [PATCH] Allow overwriting the IndexFull function for tests --- repository/index.go | 4 ++-- repository/master_index.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/repository/index.go b/repository/index.go index 979401a91..b89d8f25e 100644 --- a/repository/index.go +++ b/repository/index.go @@ -64,8 +64,8 @@ const ( indexMaxAge = 15 * time.Minute ) -// Full returns true iff the index is "full enough" to be saved as a preliminary index. -func (idx *Index) Full() bool { +// IndexFull returns true iff the index is "full enough" to be saved as a preliminary index. +var IndexFull = func(idx *Index) bool { idx.m.Lock() defer idx.m.Unlock() diff --git a/repository/master_index.go b/repository/master_index.go index c6efc20e4..4d52789af 100644 --- a/repository/master_index.go +++ b/repository/master_index.go @@ -206,7 +206,7 @@ func (mi *MasterIndex) FullIndexes() []*Index { continue } - if idx.Full() { + if IndexFull(idx) { debug.Log("MasterIndex.FullIndexes", "index %p is full", idx) list = append(list, idx) } else {