aboutsummaryrefslogtreecommitdiffstats
path: root/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'common_test.go')
-rw-r--r--common_test.go27
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
}