diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-12 01:59:53 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-12 01:59:53 +0200 |
commit | 805cc777b083fee68a8834ebe1823d0b9dc6a00f (patch) | |
tree | e497602859f7e238072a31d20477db6a656f6482 /remote_test.go | |
parent | 68307cee4259c6c4fded8124af7f993f0266a545 (diff) | |
download | go-git-805cc777b083fee68a8834ebe1823d0b9dc6a00f.tar.gz |
general: usage of the new Reference objects
Diffstat (limited to 'remote_test.go')
-rw-r--r-- | remote_test.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/remote_test.go b/remote_test.go index 9e3e678..9f476a2 100644 --- a/remote_test.go +++ b/remote_test.go @@ -1,6 +1,7 @@ package git import ( + "gopkg.in/src-d/go-git.v4/clients/common" "gopkg.in/src-d/go-git.v4/clients/http" "gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/formats/packfile" @@ -34,7 +35,7 @@ func (s *SuiteRemote) TestDefaultBranch(c *C) { c.Assert(err, IsNil) c.Assert(r.Connect(), IsNil) - c.Assert(r.DefaultBranch(), Equals, "refs/heads/master") + c.Assert(r.Head().Name(), Equals, core.ReferenceName("refs/heads/master")) } func (s *SuiteRemote) TestCapabilities(c *C) { @@ -46,14 +47,17 @@ func (s *SuiteRemote) TestCapabilities(c *C) { c.Assert(r.Capabilities().Get("agent").Values, HasLen, 1) } -func (s *SuiteRemote) TestFetchDefaultBranch(c *C) { +func (s *SuiteRemote) TestFetch(c *C) { r, err := NewRemote(RepositoryFixture) r.upSrv = &MockGitUploadPackService{} c.Assert(err, IsNil) c.Assert(r.Connect(), IsNil) - reader, err := r.FetchDefaultBranch() + req := &common.GitUploadPackRequest{} + req.Want(r.Head().Hash()) + + reader, err := r.Fetch(req) c.Assert(err, IsNil) packfileReader := packfile.NewStream(reader) @@ -74,7 +78,6 @@ func (s *SuiteRemote) TestHead(c *C) { err = r.Connect() c.Assert(err, IsNil) - hash, err := r.Head() c.Assert(err, IsNil) - c.Assert(hash, Equals, core.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")) + c.Assert(r.Head().Hash(), Equals, core.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")) } |