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.go27
1 files changed, 17 insertions, 10 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index d2c5287..25b3653 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -2,7 +2,6 @@
package filesystem
import (
- "gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit"
"gopkg.in/src-d/go-billy.v4"
@@ -12,8 +11,6 @@ import (
// standard git format (this is, the .git directory). Zero values of this type
// are not safe to use, see the NewStorage function below.
type Storage struct {
- options storer.Options
-
fs billy.Filesystem
dir *dotgit.DotGit
@@ -25,26 +22,36 @@ 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) {
- return NewStorageWithOptions(fs, storer.Options{})
+ return NewStorageWithOptions(fs, Options{})
}
// NewStorageWithOptions returns a new Storage backed by a given `fs.Filesystem`
func NewStorageWithOptions(
fs billy.Filesystem,
- ops storer.Options,
+ ops Options,
) (*Storage, error) {
- dir := dotgit.NewWithOptions(fs, ops)
- o, err := NewObjectStorage(dir)
+ dirOps := dotgit.Options{
+ ExclusiveAccess: ops.ExclusiveAccess,
+ }
+
+ dir := dotgit.NewWithOptions(fs, dirOps)
+ o, err := NewObjectStorageWithOptions(dir, ops)
if err != nil {
return nil, err
}
return &Storage{
- options: ops,
- fs: fs,
- dir: dir,
+ fs: fs,
+ dir: dir,
ObjectStorage: o,
ReferenceStorage: ReferenceStorage{dir: dir},