diff options
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/packfile/decoder_test.go | 2 | ||||
-rw-r--r-- | plumbing/transport/file/receive_pack_test.go | 4 | ||||
-rw-r--r-- | plumbing/transport/file/server_test.go | 4 | ||||
-rw-r--r-- | plumbing/transport/file/upload_pack_test.go | 7 | ||||
-rw-r--r-- | plumbing/transport/git/receive_pack_test.go | 4 | ||||
-rw-r--r-- | plumbing/transport/server/loader.go | 10 | ||||
-rw-r--r-- | plumbing/transport/server/server_test.go | 22 |
7 files changed, 26 insertions, 27 deletions
diff --git a/plumbing/format/packfile/decoder_test.go b/plumbing/format/packfile/decoder_test.go index f081fd7..f1e2ed7 100644 --- a/plumbing/format/packfile/decoder_test.go +++ b/plumbing/format/packfile/decoder_test.go @@ -3,7 +3,7 @@ package packfile_test import ( "io" - "gopkg.in/src-d/go-billy.v2/memfs" + "gopkg.in/src-d/go-billy.v3/memfs" "github.com/src-d/go-git-fixtures" "gopkg.in/src-d/go-git.v4/plumbing" diff --git a/plumbing/transport/file/receive_pack_test.go b/plumbing/transport/file/receive_pack_test.go index 5bbad44..ab21aea 100644 --- a/plumbing/transport/file/receive_pack_test.go +++ b/plumbing/transport/file/receive_pack_test.go @@ -23,11 +23,11 @@ func (s *ReceivePackSuite) SetUpSuite(c *C) { func (s *ReceivePackSuite) SetUpTest(c *C) { fixture := fixtures.Basic().One() - path := fixture.DotGit().Base() + path := fixture.DotGit().Root() s.Endpoint = prepareRepo(c, path) fixture = fixtures.ByTag("empty").One() - path = fixture.DotGit().Base() + path = fixture.DotGit().Root() s.EmptyEndpoint = prepareRepo(c, path) s.NonExistentEndpoint = prepareRepo(c, "/non-existent") diff --git a/plumbing/transport/file/server_test.go b/plumbing/transport/file/server_test.go index 176d6ee..ee72282 100644 --- a/plumbing/transport/file/server_test.go +++ b/plumbing/transport/file/server_test.go @@ -24,10 +24,10 @@ func (s *ServerSuite) SetUpSuite(c *C) { s.RemoteName = "test" fixture := fixtures.Basic().One() - s.SrcPath = fixture.DotGit().Base() + s.SrcPath = fixture.DotGit().Root() fixture = fixtures.ByTag("empty").One() - s.DstPath = fixture.DotGit().Base() + s.DstPath = fixture.DotGit().Root() cmd := exec.Command("git", "remote", "add", s.RemoteName, s.DstPath) cmd.Dir = s.SrcPath diff --git a/plumbing/transport/file/upload_pack_test.go b/plumbing/transport/file/upload_pack_test.go index f013683..f894935 100644 --- a/plumbing/transport/file/upload_pack_test.go +++ b/plumbing/transport/file/upload_pack_test.go @@ -24,13 +24,13 @@ func (s *UploadPackSuite) SetUpSuite(c *C) { s.UploadPackSuite.Client = DefaultClient fixture := fixtures.Basic().One() - path := fixture.DotGit().Base() + path := fixture.DotGit().Root() ep, err := transport.NewEndpoint(path) c.Assert(err, IsNil) s.Endpoint = ep fixture = fixtures.ByTag("empty").One() - path = fixture.DotGit().Base() + path = fixture.DotGit().Root() ep, err = transport.NewEndpoint(path) c.Assert(err, IsNil) s.EmptyEndpoint = ep @@ -74,6 +74,7 @@ func (s *UploadPackSuite) TestNonExistentCommand(c *C) { cmd := "/non-existent-git" client := NewClient(cmd, cmd) session, err := client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) - c.Assert(err, ErrorMatches, ".*no such file or directory.*") + // Error message is OS-dependant, so do a broad check + c.Assert(err, ErrorMatches, ".*file.*") c.Assert(session, IsNil) } diff --git a/plumbing/transport/git/receive_pack_test.go b/plumbing/transport/git/receive_pack_test.go index d73966e..326ef1b 100644 --- a/plumbing/transport/git/receive_pack_test.go +++ b/plumbing/transport/git/receive_pack_test.go @@ -43,7 +43,7 @@ func (s *ReceivePackSuite) SetUpTest(c *C) { err = os.MkdirAll(interpolatedBase, 0755) c.Assert(err, IsNil) - dotgit := fixtures.Basic().One().DotGit().Base() + dotgit := fixtures.Basic().One().DotGit().Root() prepareRepo(c, dotgit) err = os.Rename(dotgit, filepath.Join(interpolatedBase, "basic.git")) c.Assert(err, IsNil) @@ -52,7 +52,7 @@ func (s *ReceivePackSuite) SetUpTest(c *C) { c.Assert(err, IsNil) s.ReceivePackSuite.Endpoint = ep - dotgit = fixtures.ByTag("empty").One().DotGit().Base() + dotgit = fixtures.ByTag("empty").One().DotGit().Root() prepareRepo(c, dotgit) err = os.Rename(dotgit, filepath.Join(interpolatedBase, "empty.git")) c.Assert(err, IsNil) diff --git a/plumbing/transport/server/loader.go b/plumbing/transport/server/loader.go index 386c2f0..d4eccd4 100644 --- a/plumbing/transport/server/loader.go +++ b/plumbing/transport/server/loader.go @@ -5,8 +5,8 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/storage/filesystem" - "gopkg.in/src-d/go-billy.v2" - "gopkg.in/src-d/go-billy.v2/osfs" + "gopkg.in/src-d/go-billy.v3" + "gopkg.in/src-d/go-billy.v3/osfs" ) // DefaultLoader is a filesystem loader ignoring host and resolving paths to /. @@ -34,7 +34,11 @@ func NewFilesystemLoader(base billy.Filesystem) Loader { // storer for it. Returns transport.ErrRepositoryNotFound if a repository does // not exist in the given path. func (l *fsLoader) Load(ep transport.Endpoint) (storer.Storer, error) { - fs := l.base.Dir(ep.Path()) + fs, err := l.base.Chroot(ep.Path()) + if err != nil { + return nil, err + } + if _, err := fs.Stat("config"); err != nil { return nil, transport.ErrRepositoryNotFound } diff --git a/plumbing/transport/server/server_test.go b/plumbing/transport/server/server_test.go index 6a64674..0f7201c 100644 --- a/plumbing/transport/server/server_test.go +++ b/plumbing/transport/server/server_test.go @@ -1,7 +1,6 @@ package server_test import ( - "fmt" "testing" "github.com/src-d/go-git-fixtures" @@ -16,8 +15,6 @@ import ( func Test(t *testing.T) { TestingT(t) } -const inprocScheme = "inproc" - type BaseSuite struct { fixtures.Suite loader server.MapLoader @@ -29,15 +26,15 @@ func (s *BaseSuite) SetUpSuite(c *C) { s.Suite.SetUpSuite(c) s.loader = server.MapLoader{} s.client = server.NewServer(s.loader) - s.clientBackup = client.Protocols[inprocScheme] - client.Protocols[inprocScheme] = s.client + s.clientBackup = client.Protocols["file"] + client.Protocols["file"] = s.client } func (s *BaseSuite) TearDownSuite(c *C) { if s.clientBackup == nil { - delete(client.Protocols, inprocScheme) + delete(client.Protocols, "file") } else { - client.Protocols[inprocScheme] = s.clientBackup + client.Protocols["file"] = s.clientBackup } } @@ -46,9 +43,8 @@ func (s *BaseSuite) prepareRepositories(c *C, basic *transport.Endpoint, f := fixtures.Basic().One() fs := f.DotGit() - path := fs.Base() - url := fmt.Sprintf("%s://%s", inprocScheme, path) - ep, err := transport.NewEndpoint(url) + path := fs.Root() + ep, err := transport.NewEndpoint(path) c.Assert(err, IsNil) *basic = ep sto, err := filesystem.NewStorage(fs) @@ -56,15 +52,13 @@ func (s *BaseSuite) prepareRepositories(c *C, basic *transport.Endpoint, s.loader[ep.String()] = sto path = "/empty.git" - url = fmt.Sprintf("%s://%s", inprocScheme, path) - ep, err = transport.NewEndpoint(url) + ep, err = transport.NewEndpoint(path) c.Assert(err, IsNil) *empty = ep s.loader[ep.String()] = memory.NewStorage() path = "/non-existent.git" - url = fmt.Sprintf("%s://%s", inprocScheme, path) - ep, err = transport.NewEndpoint(url) + ep, err = transport.NewEndpoint(path) c.Assert(err, IsNil) *nonExistent = ep } |