aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-27 17:23:00 +0200
committerGitHub <noreply@github.com>2017-07-27 17:23:00 +0200
commit7b08a3005480a50f0f4290aff8f3702085d5e30d (patch)
tree2977c3d68b410a1593767245226bfa38dab82a88
parent8c57f96d4678087e06035095e67ad1239d6509ce (diff)
parent35d5595b306148b626fdfbfd8a7c77a4687179f4 (diff)
downloadgo-git-7b08a3005480a50f0f4290aff8f3702085d5e30d.tar.gz
Merge pull request #517 from smola/more-cache-reuse
filesystem: reuse cache for packfile iterator
-rw-r--r--storage/filesystem/object.go7
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,