aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/storage.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-08-30 18:33:37 +0200
committerJavi Fontan <jfontan@gmail.com>2018-08-30 18:33:37 +0200
commit82945e31dd8bce5fc51d4fd16d696a6d326e5f44 (patch)
tree0ebee0c8101266230e60edc47a1f3696722173ee /storage/filesystem/storage.go
parent1e1a7d0623459807d6f1e871492147f971f7540c (diff)
downloadgo-git-82945e31dd8bce5fc51d4fd16d696a6d326e5f44.tar.gz
git, storer: use a common storer.Options for storer and PlainOpen
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'storage/filesystem/storage.go')
-rw-r--r--storage/filesystem/storage.go25
1 files changed, 8 insertions, 17 deletions
diff --git a/storage/filesystem/storage.go b/storage/filesystem/storage.go
index a969a1f..24e6454 100644
--- a/storage/filesystem/storage.go
+++ b/storage/filesystem/storage.go
@@ -2,6 +2,7 @@
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"
@@ -11,7 +12,7 @@ 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 {
- StorageOptions
+ storer.Options
fs billy.Filesystem
dir *dotgit.DotGit
@@ -24,36 +25,26 @@ type Storage struct {
ModuleStorage
}
-// StorageOptions holds configuration for the storage.
-type StorageOptions struct {
- // Static means that the filesystem is not modified while the repo is open.
- Static bool
-}
-
// NewStorage returns a new Storage backed by a given `fs.Filesystem`
func NewStorage(fs billy.Filesystem) (*Storage, error) {
- return NewStorageWithOptions(fs, StorageOptions{})
+ return NewStorageWithOptions(fs, storer.Options{})
}
// NewStorageWithOptions returns a new Storage backed by a given `fs.Filesystem`
func NewStorageWithOptions(
fs billy.Filesystem,
- ops StorageOptions,
+ ops storer.Options,
) (*Storage, error) {
- dOps := dotgit.DotGitOptions{
- Static: ops.Static,
- }
-
- dir := dotgit.NewWithOptions(fs, dOps)
+ dir := dotgit.NewWithOptions(fs, ops)
o, err := NewObjectStorage(dir)
if err != nil {
return nil, err
}
return &Storage{
- StorageOptions: ops,
- fs: fs,
- dir: dir,
+ Options: ops,
+ fs: fs,
+ dir: dir,
ObjectStorage: o,
ReferenceStorage: ReferenceStorage{dir: dir},