aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'storage/filesystem/storage.go')
-rw-r--r--storage/filesystem/storage.go23
1 files changed, 21 insertions, 2 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index 622bb4a..25b3653 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -22,10 +22,29 @@ type Storage struct {
ModuleStorage
}
+// Options holds configuration for the storage.
+type Options struct {
+ // ExclusiveAccess means that the filesystem is not modified externally
+ // while the repo is open.
+ ExclusiveAccess bool
+}
+
// NewStorage returns a new Storage backed by a given `fs.Filesystem`
func NewStorage(fs billy.Filesystem) (*Storage, error) {
- dir := dotgit.New(fs)
- o, err := NewObjectStorage(dir)
+ return NewStorageWithOptions(fs, Options{})
+}
+
+// NewStorageWithOptions returns a new Storage backed by a given `fs.Filesystem`
+func NewStorageWithOptions(
+ fs billy.Filesystem,
+ ops Options,
+) (*Storage, error) {
+ dirOps := dotgit.Options{
+ ExclusiveAccess: ops.ExclusiveAccess,
+ }
+
+ dir := dotgit.NewWithOptions(fs, dirOps)
+ o, err := NewObjectStorageWithOptions(dir, ops)
if err != nil {
return nil, err
}