Skip to content

Commit

Permalink
git: do not expose storage options in PlainOpen
Browse files Browse the repository at this point in the history
Signed-off-by: Javi Fontan <[email protected]>
  • Loading branch information
jfontan committed Aug 31, 2018
1 parent d7e6cf5 commit 2a7c664
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
4 changes: 0 additions & 4 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/sideband"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
)

Expand Down Expand Up @@ -429,9 +428,6 @@ func (o *GrepOptions) Validate(w *Worktree) error {
// PlainOpenOptions describes how opening a plain repository should be
// performed.
type PlainOpenOptions struct {
// Storage layer options.
Storage storer.Options

// DetectDotGit defines whether parent directories should be
// walked until a .git directory or file is found.
DetectDotGit bool
Expand Down
2 changes: 1 addition & 1 deletion repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func PlainOpenWithOptions(path string, o *PlainOpenOptions) (*Repository, error)
return nil, err
}

s, err := filesystem.NewStorageWithOptions(dot, o.Storage)
s, err := filesystem.NewStorage(dot)
if err != nil {
return nil, err
}
Expand Down
22 changes: 0 additions & 22 deletions repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,28 +550,6 @@ func (s *RepositorySuite) TestPlainOpenNotExistsDetectDotGit(c *C) {
c.Assert(r, IsNil)
}

func (s *RepositorySuite) TestPlainOpenStatic(c *C) {
dir, err := ioutil.TempDir("", "plain-open")
c.Assert(err, IsNil)
defer os.RemoveAll(dir)

r, err := PlainInit(dir, true)
c.Assert(err, IsNil)
c.Assert(r, NotNil)

op := &PlainOpenOptions{
Storage: storer.Options{Static: true},
}

r, err = PlainOpenWithOptions(dir, op)
c.Assert(err, IsNil)
c.Assert(r, NotNil)

sto, ok := r.Storer.(*filesystem.Storage)
c.Assert(ok, Equals, true)
c.Assert(sto.Options.Static, Equals, true)
}

func (s *RepositorySuite) TestPlainClone(c *C) {
r, err := PlainClone(c.MkDir(), false, &CloneOptions{
URL: s.GetBasicLocalRepositoryURL(),
Expand Down

0 comments on commit 2a7c664

Please sign in to comment.