aboutsummaryrefslogtreecommitdiffstats
path: root/repository.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-14 00:44:18 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-14 00:44:18 +0200
commitf826cf9d42cc34e2ae5aaf6ede892ecab9d2f198 (patch)
tree7555e7596887f239ce26828e98142e4df25c388f /repository.go
parent79087748f60f9aba219624a0fe9f4d33a0b51236 (diff)
downloadgo-git-f826cf9d42cc34e2ae5aaf6ede892ecab9d2f198.tar.gz
fix tests and examples
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()