aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository.go')
-rw-r--r--repository.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/repository.go b/repository.go
index f286e03..6f2679c 100644
--- a/repository.go
+++ b/repository.go
@@ -5,7 +5,9 @@ import (
"gopkg.in/src-d/go-git.v4/clients/common"
"gopkg.in/src-d/go-git.v4/core"
+ "gopkg.in/src-d/go-git.v4/storage/filesystem"
"gopkg.in/src-d/go-git.v4/storage/memory"
+ "gopkg.in/src-d/go-git.v4/utils/fs"
)
var (
@@ -32,6 +34,16 @@ func NewMemoryRepository() (*Repository, error) {
return NewRepository(memory.NewStorage())
}
+// NewFilesystemRepository creates a new repository, backed by a filesystem.Storage
+func NewFilesystemRepository(fs fs.FS, path string) (*Repository, error) {
+ s, err := filesystem.NewStorage(fs, path)
+ if err != nil {
+ return nil, err
+ }
+
+ return NewRepository(s)
+}
+
// NewRepository creates a new repository with the given Storage
func NewRepository(s core.Storage) (*Repository, error) {
os, err := s.ObjectStorage()