diff options
-rw-r--r-- | plumbing/cache/object_lru.go | 6 | ||||
-rw-r--r-- | plumbing/format/packfile/decoder.go | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/plumbing/cache/object_lru.go b/plumbing/cache/object_lru.go index d99a5c9..9e850b2 100644 --- a/plumbing/cache/object_lru.go +++ b/plumbing/cache/object_lru.go @@ -55,7 +55,7 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) { return } - if c.actualSize+objSize > c.MaxSize { + for c.actualSize+objSize > c.MaxSize { last := c.ll.Back() lastObj := last.Value.(plumbing.EncodedObject) lastSize := FileSize(lastObj.Size()) @@ -63,10 +63,6 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) { c.ll.Remove(last) delete(c.cache, lastObj.Hash()) c.actualSize -= lastSize - - if c.actualSize+objSize > c.MaxSize { - return - } } ee := c.ll.PushFront(obj) diff --git a/plumbing/format/packfile/decoder.go b/plumbing/format/packfile/decoder.go index cb78701..f706e5d 100644 --- a/plumbing/format/packfile/decoder.go +++ b/plumbing/format/packfile/decoder.go @@ -407,6 +407,8 @@ func (d *Decoder) fillOFSDeltaObjectContent(obj plumbing.EncodedObject, offset i if err != nil { return 0, err } + + d.cachePut(base) } obj.SetType(base.Type()) |