aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/storage.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-09-03 19:40:22 +0200
committerJavi Fontan <jfontan@gmail.com>2018-09-03 19:40:22 +0200
commit874f669becc25489081306bbbcbbc27b970f6295 (patch)
tree82a106646428b4656f4483afd7b38696eede2cbf /storage/filesystem/storage.go
parent95acbf6c3958b7540a8549aa049051325fcecd8b (diff)
downloadgo-git-874f669becc25489081306bbbcbbc27b970f6295.tar.gz
storage/filesystem: move Options to filesytem and dotgit
Signed-off-by: Javi Fontan <jfontan@gmail.com>
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},