Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 7b08a30

Browse files
authored
Merge pull request #517 from smola/more-cache-reuse
filesystem: reuse cache for packfile iterator
2 parents 8c57f96 + 35d5595 commit 7b08a30

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

storage/filesystem/object.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (s *ObjectStorage) buildPackfileIters(t plumbing.ObjectType, seen map[plumb
262262
return nil, err
263263
}
264264

265-
iter, err := newPackfileIter(pack, t, seen, s.index[h])
265+
iter, err := newPackfileIter(pack, t, seen, s.index[h], s.DeltaBaseCache)
266266
if err != nil {
267267
return nil, err
268268
}
@@ -284,11 +284,11 @@ type packfileIter struct {
284284
}
285285

286286
func NewPackfileIter(f billy.File, t plumbing.ObjectType) (storer.EncodedObjectIter, error) {
287-
return newPackfileIter(f, t, make(map[plumbing.Hash]bool), nil)
287+
return newPackfileIter(f, t, make(map[plumbing.Hash]bool), nil, nil)
288288
}
289289

290290
func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash]bool,
291-
index *packfile.Index) (storer.EncodedObjectIter, error) {
291+
index *packfile.Index, cache cache.Object) (storer.EncodedObjectIter, error) {
292292
s := packfile.NewScanner(f)
293293
_, total, err := s.Header()
294294
if err != nil {
@@ -301,6 +301,7 @@ func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash
301301
}
302302

303303
d.SetIndex(index)
304+
d.DeltaBaseCache = cache
304305

305306
return &packfileIter{
306307
f: f,

0 commit comments

Comments
 (0)