aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-07 16:02:46 +0100
committerAntonio Jesus Navarro Perez <antonio@sourced.tech>2017-02-07 16:02:46 +0100
commitb872b71112ed4034bbd9c33a0babd6353b582429 (patch)
treec77297e16413c308ab8fbb27e8d86f72fffe786a /storage/filesystem/object.go
parent8d45daf52a46b8b2cd496c9e885a1ac6d78007e3 (diff)
downloadgo-git-b872b71112ed4034bbd9c33a0babd6353b582429.tar.gz
Fix missing objects if they where deltified using ref-delta
- Deleted invalid logic that returned nil if an ref-delta was not found into the decoder index. This logic was missing objects if it was deltified using ref-deltas. - Now, to avoid that problem, index is mandatory to decode correctly a packfile of a specific type. Decoder.SetOffsets method now is called into the EncodedObjectIterator to avoid this problem.
Diffstat (limited to 'storage/filesystem/object.go')
-rw-r--r--storage/filesystem/object.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 2975c1e..904f6fe 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -233,7 +233,7 @@ func (s *ObjectStorage) buildPackfileIters(
return nil, err
}
- iter, err := newPackfileIter(pack, t, seen)
+ iter, err := newPackfileIter(pack, t, seen, s.index[h])
if err != nil {
return nil, err
}
@@ -272,10 +272,11 @@ type packfileIter struct {
}
func NewPackfileIter(f billy.File, t plumbing.ObjectType) (storer.EncodedObjectIter, error) {
- return newPackfileIter(f, t, make(map[plumbing.Hash]bool))
+ return newPackfileIter(f, t, make(map[plumbing.Hash]bool), nil)
}
-func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash]bool) (storer.EncodedObjectIter, error) {
+func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash]bool,
+ index idx) (storer.EncodedObjectIter, error) {
s := packfile.NewScanner(f)
_, total, err := s.Header()
if err != nil {
@@ -287,6 +288,8 @@ func newPackfileIter(f billy.File, t plumbing.ObjectType, seen map[plumbing.Hash
return nil, err
}
+ d.SetOffsets(index)
+
return &packfileIter{
f: f,
d: d,