diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 12:15:40 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-06-18 12:15:40 +0200 |
commit | abb9ec0f3efea571b7f19b7391eb7c152c899f45 (patch) | |
tree | 703bcd8caf958007e90d6694e5225084b3ddfdb5 /storage/filesystem/internal/dotgit/dotgit_test.go | |
parent | bf3a92052f715c507ace0cb9f2b7fb358f623abc (diff) | |
download | go-git-abb9ec0f3efea571b7f19b7391eb7c152c899f45.tar.gz |
*: upgrade to go-billy.v3, merge
Diffstat (limited to 'storage/filesystem/internal/dotgit/dotgit_test.go')
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit_test.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/storage/filesystem/internal/dotgit/dotgit_test.go b/storage/filesystem/internal/dotgit/dotgit_test.go index f06f908..6151c8f 100644 --- a/storage/filesystem/internal/dotgit/dotgit_test.go +++ b/storage/filesystem/internal/dotgit/dotgit_test.go @@ -12,7 +12,7 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-billy.v2/osfs" + "gopkg.in/src-d/go-billy.v3/osfs" ) func Test(t *testing.T) { TestingT(t) } @@ -157,7 +157,7 @@ func (s *SuiteDotGit) TestRemoveRefFromPackedRefs(c *C) { err := dir.RemoveRef(name) c.Assert(err, IsNil) - b, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath)) + b, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath)) c.Assert(err, IsNil) c.Assert(string(b), Equals, ""+ @@ -170,7 +170,7 @@ func (s *SuiteDotGit) TestRemoveRefNonExistent(c *C) { fs := fixtures.Basic().ByTag(".git").One().DotGit() dir := New(fs) - packedRefs := filepath.Join(fs.Base(), packedRefsPath) + packedRefs := filepath.Join(fs.Root(), packedRefsPath) before, err := ioutil.ReadFile(packedRefs) c.Assert(err, IsNil) @@ -188,7 +188,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs(c *C) { fs := fixtures.Basic().ByTag(".git").One().DotGit() dir := New(fs) - packedRefs := filepath.Join(fs.Base(), packedRefsPath) + packedRefs := filepath.Join(fs.Root(), packedRefsPath) brokenContent := "BROKEN STUFF REALLY BROKEN" err := ioutil.WriteFile(packedRefs, []byte(brokenContent), os.FileMode(0755)) @@ -198,7 +198,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs(c *C) { err = dir.RemoveRef(name) c.Assert(err, NotNil) - after, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath)) + after, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath)) c.Assert(err, IsNil) c.Assert(brokenContent, Equals, string(after)) @@ -208,7 +208,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs2(c *C) { fs := fixtures.Basic().ByTag(".git").One().DotGit() dir := New(fs) - packedRefs := filepath.Join(fs.Base(), packedRefsPath) + packedRefs := filepath.Join(fs.Root(), packedRefsPath) brokenContent := strings.Repeat("a", bufio.MaxScanTokenSize*2) err := ioutil.WriteFile(packedRefs, []byte(brokenContent), os.FileMode(0755)) @@ -218,7 +218,7 @@ func (s *SuiteDotGit) TestRemoveRefInvalidPackedRefs2(c *C) { err = dir.RemoveRef(name) c.Assert(err, NotNil) - after, err := ioutil.ReadFile(filepath.Join(fs.Base(), packedRefsPath)) + after, err := ioutil.ReadFile(filepath.Join(fs.Root(), packedRefsPath)) c.Assert(err, IsNil) c.Assert(brokenContent, Equals, string(after)) @@ -243,7 +243,7 @@ func (s *SuiteDotGit) TestConfig(c *C) { file, err := dir.Config() c.Assert(err, IsNil) - c.Assert(filepath.Base(file.Filename()), Equals, "config") + c.Assert(filepath.Base(file.Name()), Equals, "config") } func (s *SuiteDotGit) TestConfigWriteAndConfig(c *C) { @@ -362,7 +362,7 @@ func (s *SuiteDotGit) TestObjectPack(c *C) { pack, err := dir.ObjectPack(f.PackfileHash) c.Assert(err, IsNil) - c.Assert(filepath.Ext(pack.Filename()), Equals, ".pack") + c.Assert(filepath.Ext(pack.Name()), Equals, ".pack") } func (s *SuiteDotGit) TestObjectPackIdx(c *C) { @@ -372,7 +372,7 @@ func (s *SuiteDotGit) TestObjectPackIdx(c *C) { idx, err := dir.ObjectPackIdx(f.PackfileHash) c.Assert(err, IsNil) - c.Assert(filepath.Ext(idx.Filename()), Equals, ".idx") + c.Assert(filepath.Ext(idx.Name()), Equals, ".idx") } func (s *SuiteDotGit) TestObjectPackNotFound(c *C) { @@ -445,7 +445,7 @@ func (s *SuiteDotGit) TestObject(c *C) { file, err := dir.Object(hash) c.Assert(err, IsNil) c.Assert(strings.HasSuffix( - file.Filename(), "objects/03/db8e1fbe133a480f2867aac478fd866686d69e"), + file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")), Equals, true, ) } @@ -464,6 +464,7 @@ func (s *SuiteDotGit) TestSubmodules(c *C) { fs := fixtures.ByTag("submodule").One().DotGit() dir := New(fs) - m := dir.Module("basic") - c.Assert(strings.HasSuffix(m.Base(), ".git/module/basic"), Equals, true) + m, err := dir.Module("basic") + c.Assert(err, IsNil) + c.Assert(strings.HasSuffix(m.Root(), m.Join(".git", "module", "basic")), Equals, true) } |