aboutsummaryrefslogtreecommitdiffstats
path: root/storage/seekable
diff options
context:
space:
mode:
Diffstat (limited to 'storage/seekable')
-rw-r--r--storage/seekable/internal/index/index.go4
-rw-r--r--storage/seekable/storage.go7
-rw-r--r--storage/seekable/storage_test.go2
3 files changed, 9 insertions, 4 deletions
diff --git a/storage/seekable/internal/index/index.go b/storage/seekable/internal/index/index.go
index 4282f3e..737aca6 100644
--- a/storage/seekable/internal/index/index.go
+++ b/storage/seekable/internal/index/index.go
@@ -51,8 +51,8 @@ func NewFromPackfile(rs io.ReadSeeker) (Index, error) {
return nil, err
}
- obj, err := p.ReadObject()
- if err != nil {
+ obj := &core.MemoryObject{}
+ if err := p.FillObject(obj); err != nil {
return nil, err
}
diff --git a/storage/seekable/storage.go b/storage/seekable/storage.go
index 9cc37ba..e056c54 100644
--- a/storage/seekable/storage.go
+++ b/storage/seekable/storage.go
@@ -90,6 +90,10 @@ func buildIndexFromIdxfile(fs fs.FS, path string) (index.Index, error) {
return index.NewFromIdx(f)
}
+func (s *ObjectStorage) NewObject() core.Object {
+ return &core.MemoryObject{}
+}
+
// Set adds a new object to the storage. As this functionality is not
// yet supported, this method always returns a "not implemented yet"
// error an zero hash.
@@ -131,7 +135,8 @@ func (s *ObjectStorage) Get(h core.Hash) (core.Object, error) {
r.HashToOffset = map[core.Hash]int64(s.index)
p := packfile.NewParser(r)
- return p.ReadObject()
+ obj := s.NewObject()
+ return obj, p.FillObject(obj)
}
// Iter returns an iterator for all the objects in the packfile with the
diff --git a/storage/seekable/storage_test.go b/storage/seekable/storage_test.go
index 2002d2b..bd12ed1 100644
--- a/storage/seekable/storage_test.go
+++ b/storage/seekable/storage_test.go
@@ -321,6 +321,6 @@ func (s *FsSuite) TestSet(c *C) {
sto, err := seekable.New(fs, gitPath)
c.Assert(err, IsNil)
- _, err = sto.Set(&memory.Object{})
+ _, err = sto.Set(&core.MemoryObject{})
c.Assert(err, ErrorMatches, "not implemented yet")
}