diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-03-10 01:41:19 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2020-03-10 01:41:19 +0100 |
commit | 2637279338ca9736c22b5e15fca916121ae8d089 (patch) | |
tree | 2273e55f2d2b68b9b6335924d6b00ddf3417e8e7 /storage/filesystem | |
parent | 2bdfd91f04068220a72feeade31defc09f2a601e (diff) | |
download | go-git-2637279338ca9736c22b5e15fca916121ae8d089.tar.gz |
*: migration from go-git-fixtures/v4 and go-git/gcfg
Diffstat (limited to 'storage/filesystem')
-rw-r--r-- | storage/filesystem/config_test.go | 2 | ||||
-rw-r--r-- | storage/filesystem/dotgit/dotgit_test.go | 15 | ||||
-rw-r--r-- | storage/filesystem/dotgit/writers_test.go | 2 | ||||
-rw-r--r-- | storage/filesystem/object_test.go | 16 | ||||
-rw-r--r-- | storage/filesystem/storage_test.go | 1 |
5 files changed, 11 insertions, 25 deletions
diff --git a/storage/filesystem/config_test.go b/storage/filesystem/config_test.go index 89d4210..fe84698 100644 --- a/storage/filesystem/config_test.go +++ b/storage/filesystem/config_test.go @@ -9,7 +9,7 @@ import ( "github.com/go-git/go-billy/v5/osfs" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" + "github.com/go-git/go-git-fixtures/v4" ) type ConfigSuite struct { diff --git a/storage/filesystem/dotgit/dotgit_test.go b/storage/filesystem/dotgit/dotgit_test.go index 87b702d..cf81c23 100644 --- a/storage/filesystem/dotgit/dotgit_test.go +++ b/storage/filesystem/dotgit/dotgit_test.go @@ -13,8 +13,8 @@ import ( "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-billy/v5/osfs" + fixtures "github.com/go-git/go-git-fixtures/v4" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" ) func Test(t *testing.T) { TestingT(t) } @@ -167,7 +167,6 @@ func (s *SuiteDotGit) TestRefsFromReferenceFile(c *C) { } func BenchmarkRefMultipleTimes(b *testing.B) { - fixtures.Init() fs := fixtures.Basic().ByTag(".git").One().DotGit() refname := plumbing.ReferenceName("refs/remotes/origin/branch") @@ -456,7 +455,7 @@ func testObjectPacks(c *C, fs billy.Filesystem, dir *DotGit, f *fixtures.Fixture hashes, err := dir.ObjectPacks() c.Assert(err, IsNil) c.Assert(hashes, HasLen, 1) - c.Assert(hashes[0], Equals, f.PackfileHash) + c.Assert(hashes[0], Equals, plumbing.NewHash(f.PackfileHash)) // Make sure that a random file in the pack directory doesn't // break everything. @@ -481,7 +480,7 @@ func (s *SuiteDotGit) TestObjectPack(c *C) { fs := f.DotGit() dir := New(fs) - pack, err := dir.ObjectPack(f.PackfileHash) + pack, err := dir.ObjectPack(plumbing.NewHash(f.PackfileHash)) c.Assert(err, IsNil) c.Assert(filepath.Ext(pack.Name()), Equals, ".pack") } @@ -491,14 +490,14 @@ func (s *SuiteDotGit) TestObjectPackWithKeepDescriptors(c *C) { fs := f.DotGit() dir := NewWithOptions(fs, Options{KeepDescriptors: true}) - pack, err := dir.ObjectPack(f.PackfileHash) + pack, err := dir.ObjectPack(plumbing.NewHash(f.PackfileHash)) c.Assert(err, IsNil) c.Assert(filepath.Ext(pack.Name()), Equals, ".pack") // Move to an specific offset pack.Seek(42, os.SEEK_SET) - pack2, err := dir.ObjectPack(f.PackfileHash) + pack2, err := dir.ObjectPack(plumbing.NewHash(f.PackfileHash)) c.Assert(err, IsNil) // If the file is the same the offset should be the same @@ -509,7 +508,7 @@ func (s *SuiteDotGit) TestObjectPackWithKeepDescriptors(c *C) { err = dir.Close() c.Assert(err, IsNil) - pack2, err = dir.ObjectPack(f.PackfileHash) + pack2, err = dir.ObjectPack(plumbing.NewHash(f.PackfileHash)) c.Assert(err, IsNil) // If the file is opened again its offset should be 0 @@ -530,7 +529,7 @@ func (s *SuiteDotGit) TestObjectPackIdx(c *C) { fs := f.DotGit() dir := New(fs) - idx, err := dir.ObjectPackIdx(f.PackfileHash) + idx, err := dir.ObjectPackIdx(plumbing.NewHash(f.PackfileHash)) c.Assert(err, IsNil) c.Assert(filepath.Ext(idx.Name()), Equals, ".idx") c.Assert(idx.Close(), IsNil) diff --git a/storage/filesystem/dotgit/writers_test.go b/storage/filesystem/dotgit/writers_test.go index 8d3b797..246d310 100644 --- a/storage/filesystem/dotgit/writers_test.go +++ b/storage/filesystem/dotgit/writers_test.go @@ -14,7 +14,7 @@ import ( "github.com/go-git/go-billy/v5/osfs" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" + "github.com/go-git/go-git-fixtures/v4" ) func (s *SuiteDotGit) TestNewObjectPack(c *C) { diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go index f9a6a76..6c35129 100644 --- a/storage/filesystem/object_test.go +++ b/storage/filesystem/object_test.go @@ -12,8 +12,8 @@ import ( "github.com/go-git/go-git/v5/plumbing/cache" "github.com/go-git/go-git/v5/storage/filesystem/dotgit" + fixtures "github.com/go-git/go-git-fixtures/v4" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" ) type FsSuite struct { @@ -248,7 +248,7 @@ func (s *FsSuite) TestPackfileReindex(c *C) { packFixture := fixtures.ByTag("packfile").ByTag("standalone").One() packFile := packFixture.Packfile() idxFile := packFixture.Idx() - packFilename := packFixture.PackfileHash.String() + packFilename := packFixture.PackfileHash testObjectHash := plumbing.NewHash("a771b1e94141480861332fd0e4684d33071306c6") // this is an object we know exists in the standalone packfile fixtures.ByTag(".git").Test(c, func(f *fixtures.Fixture) { fs := f.DotGit() @@ -333,10 +333,6 @@ func (s *FsSuite) TestGetFromObjectFileSharedCache(c *C) { } func BenchmarkPackfileIter(b *testing.B) { - if err := fixtures.Init(); err != nil { - b.Fatal(err) - } - defer func() { if err := fixtures.Clean(); err != nil { b.Fatal(err) @@ -389,10 +385,6 @@ func BenchmarkPackfileIter(b *testing.B) { } func BenchmarkPackfileIterReadContent(b *testing.B) { - if err := fixtures.Init(); err != nil { - b.Fatal(err) - } - defer func() { if err := fixtures.Clean(); err != nil { b.Fatal(err) @@ -455,10 +447,6 @@ func BenchmarkPackfileIterReadContent(b *testing.B) { } func BenchmarkGetObjectFromPackfile(b *testing.B) { - if err := fixtures.Init(); err != nil { - b.Fatal(err) - } - defer func() { if err := fixtures.Clean(); err != nil { b.Fatal(err) diff --git a/storage/filesystem/storage_test.go b/storage/filesystem/storage_test.go index 2c7c690..20eead0 100644 --- a/storage/filesystem/storage_test.go +++ b/storage/filesystem/storage_test.go @@ -39,7 +39,6 @@ func setUpTest(s *StorageSuite, c *C, storage *Storage) { var _ storer.PackfileWriter = storage s.BaseStorageSuite = test.NewBaseStorageSuite(storage) - s.BaseStorageSuite.SetUpTest(c) } func (s *StorageSuite) TestFilesystem(c *C) { |