aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/storage.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-06-05 18:09:57 +0200
committerGitHub <noreply@github.com>2017-06-05 18:09:57 +0200
commit2a00316b65585be2bf68e1ea9c0e42c6af4f5679 (patch)
treebb6699e79ffd57b9141fe9c78300d69a3715885c /storage/filesystem/storage.go
parentb25c5ead44698a4a036435c8977581ea34f761dd (diff)
parent88f88ea4cf5d44065edda8b06c2267a9dccea16e (diff)
downloadgo-git-2a00316b65585be2bf68e1ea9c0e42c6af4f5679.tar.gz
Merge pull request #409 from smola/dirty-plainopen
storage/filesystem: call initialization explicitly, fixes #408
Diffstat (limited to 'storage/filesystem/storage.go')
-rw-r--r--storage/filesystem/storage.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index dcb061d..af340d7 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -12,6 +12,7 @@ import (
// are not safe to use, see the NewStorage function below.
type Storage struct {
fs billy.Filesystem
+ dir *dotgit.DotGit
ObjectStorage
ReferenceStorage
@@ -24,10 +25,6 @@ type Storage struct {
// NewStorage returns a new Storage backed by a given `fs.Filesystem`
func NewStorage(fs billy.Filesystem) (*Storage, error) {
dir := dotgit.New(fs)
- if err := dir.Initialize(); err != nil {
- return nil, err
- }
-
o, err := newObjectStorage(dir)
if err != nil {
return nil, err
@@ -35,6 +32,7 @@ func NewStorage(fs billy.Filesystem) (*Storage, error) {
return &Storage{
fs: fs,
+ dir: dir,
ObjectStorage: o,
ReferenceStorage: ReferenceStorage{dir: dir},
@@ -49,3 +47,7 @@ func NewStorage(fs billy.Filesystem) (*Storage, error) {
func (s *Storage) Filesystem() billy.Filesystem {
return s.fs
}
+
+func (s *Storage) Init() error {
+ return s.dir.Initialize()
+}