From ae2b10d50da5455b382ab9d543be4fe859afe9e0 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Tue, 6 Sep 2016 01:56:41 +0200 Subject: storage: filesystem idx generation (wip) --- storage/filesystem/storage.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'storage/filesystem/storage.go') diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go index a0cb0b1..b0eaf6f 100644 --- a/storage/filesystem/storage.go +++ b/storage/filesystem/storage.go @@ -10,19 +10,15 @@ import ( type Storage struct { dir *dotgit.DotGit + fs fs.Filesystem o *ObjectStorage r *ReferenceStorage c *ConfigStorage } -func NewStorage(fs fs.FS, path string) (*Storage, error) { - dir, err := dotgit.New(fs, path) - if err != nil { - return nil, err - } - - return &Storage{dir: dir}, nil +func NewStorage(fs fs.Filesystem) (*Storage, error) { + return &Storage{dir: dotgit.New(fs), fs: fs}, nil } func (s *Storage) ObjectStorage() core.ObjectStorage { @@ -31,7 +27,7 @@ func (s *Storage) ObjectStorage() core.ObjectStorage { } //TODO: error being ignored - i, _ := buildIndex(s.dir) + i, _ := buildIndex(s.fs, s.dir) return &ObjectStorage{dir: s.dir, index: i} } -- cgit