diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-01-30 16:24:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 16:24:07 +0100 |
commit | a24e40af0aa2d9d512051269993a1b08c0496d12 (patch) | |
tree | 65936a6a365263c93e4b57c3b67aad6a13489e68 /common_test.go | |
parent | a48bc6e17ef6298f93ec21cdf1a5e387640673b6 (diff) | |
parent | 35378e7db9288e8244f2634a1b47981606731cef (diff) | |
download | go-git-a24e40af0aa2d9d512051269993a1b08c0496d12.tar.gz |
Merge pull request #229 from mcuadros/worktree
Worktree and new Repository Contructors
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/common_test.go b/common_test.go index 032fdfa..9c20a9a 100644 --- a/common_test.go +++ b/common_test.go @@ -5,12 +5,17 @@ import ( "testing" "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" + "srcd.works/go-billy.v1/os" ) func Test(t *testing.T) { TestingT(t) } @@ -44,7 +49,13 @@ 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 +69,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 +84,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 } |