diff options
author | Santiago M. Mola <santi@mola.io> | 2017-07-27 15:30:13 +0200 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-07-27 15:30:13 +0200 |
commit | 35d5595b306148b626fdfbfd8a7c77a4687179f4 (patch) | |
tree | 2977c3d68b410a1593767245226bfa38dab82a88 /storage/filesystem | |
parent | 8c57f96d4678087e06035095e67ad1239d6509ce (diff) | |
download | go-git-35d5595b306148b626fdfbfd8a7c77a4687179f4.tar.gz |
filesystem: reuse cache for packfile iterator
Diffstat (limited to 'storage/filesystem')
-rw-r--r-- | storage/filesystem/object.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go index 6dd910b..068abd3 100644 --- a/storage/filesystem/object.go +++ b/storage/filesystem/object.go @@ -262,7 +262,7 @@ func (s *ObjectStorage) buildPackfileIters(t plumbing.ObjectType, seen map[plumb return nil, err } - iter, err := newPackfileIter(pack, t, seen, s.index[h]) + iter, err := newPackfileIter(pack, t, seen, s.index[h], s.DeltaBaseCache) if err != nil { return nil, err } @@ -284,11 +284,11 @@ type packfileIter struct { } func NewPackfileIter(f billy.File, t plumbing.ObjectType) (storer.EncodedObjectIter, error) { - return newPackfileIter(f, t, make(map[plumbing.Hash]bool), nil) + return newPackfileIter(f, t, make(map[plumbing.Hash]bool), nil, nil) } func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash]bool, - index *packfile.Index) (storer.EncodedObjectIter, error) { + index *packfile.Index, cache cache.Object) (storer.EncodedObjectIter, error) { s := packfile.NewScanner(f) _, total, err := s.Header() if err != nil { @@ -301,6 +301,7 @@ func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash } d.SetIndex(index) + d.DeltaBaseCache = cache return &packfileIter{ f: f, |