diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-27 17:46:46 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-28 00:42:22 +0100 |
commit | 24c1878260351d9f9f6c575cbeeb5878104d6a0e (patch) | |
tree | c6a9575aa84197f7f33515ca4d55816134d1569b /common_test.go | |
parent | 1c2602a791371e76d52f89b2c8193cb200c66ad6 (diff) | |
download | go-git-24c1878260351d9f9f6c575cbeeb5878104d6a0e.tar.gz |
new repository constructors and worktree
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/common_test.go b/common_test.go index 032fdfa..8a6cb3d 100644 --- a/common_test.go +++ b/common_test.go @@ -4,13 +4,19 @@ import ( "fmt" "testing" + "srcd.works/go-billy.v1/os" + "gopkg.in/src-d/go-git.v4/fixtures" + "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" "gopkg.in/src-d/go-git.v4/plumbing/storer" "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/plumbing/transport/client" + "gopkg.in/src-d/go-git.v4/storage/filesystem" + "gopkg.in/src-d/go-git.v4/storage/memory" . "gopkg.in/check.v1" + memoryfs "srcd.works/go-billy.v1/memory" ) func Test(t *testing.T) { TestingT(t) } @@ -44,7 +50,14 @@ func (s *BaseSuite) buildBasicRepository(c *C) { } func (s *BaseSuite) NewRepository(f *fixtures.Fixture) *Repository { - r, err := NewFilesystemRepository(f.DotGit().Base()) + + fs := os.New(f.DotGit().Base()) + st, err := filesystem.NewStorage(fs) + if err != nil { + panic(err) + } + + r, err := Open(st, fs) if err != nil { panic(err) } @@ -58,13 +71,12 @@ func (s *BaseSuite) NewRepositoryFromPackfile(f *fixtures.Fixture) *Repository { return r } - r := NewMemoryRepository() - + storer := memory.NewStorage() p := f.Packfile() defer p.Close() n := packfile.NewScanner(p) - d, err := packfile.NewDecoder(n, r.s) + d, err := packfile.NewDecoder(n, storer) if err != nil { panic(err) } @@ -74,6 +86,13 @@ func (s *BaseSuite) NewRepositoryFromPackfile(f *fixtures.Fixture) *Repository { panic(err) } + storer.SetReference(plumbing.NewHashReference(plumbing.HEAD, f.Head)) + + r, err := Open(storer, memoryfs.New()) + if err != nil { + panic(err) + } + s.cache[h] = r return r } |