diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 02:26:15 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 02:26:15 +0200 |
commit | e1d8866ffa78fa16d2f39b0ba5344a7269ee5371 (patch) | |
tree | 4602b0ca341187aad77048f807cde423af410554 /remote_test.go | |
parent | 2275fa7d0c75d20103f90b0e1616937d5a9fc5e6 (diff) | |
download | go-git-e1d8866ffa78fa16d2f39b0ba5344a7269ee5371.tar.gz |
clients and remote: fetch implementation
Diffstat (limited to 'remote_test.go')
-rw-r--r-- | remote_test.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/remote_test.go b/remote_test.go index 511b690..3426fce 100644 --- a/remote_test.go +++ b/remote_test.go @@ -1,6 +1,9 @@ package git -import . "gopkg.in/check.v1" +import ( + . "gopkg.in/check.v1" + "gopkg.in/src-d/go-git.v2/packfile" +) type SuiteRemote struct{} @@ -27,3 +30,19 @@ func (s *SuiteRemote) TestCapabilities(c *C) { c.Assert(r.Connect(), IsNil) c.Assert(r.Capabilities().Get("agent"), HasLen, 1) } + +func (s *SuiteRemote) TestFetchDefaultBranch(c *C) { + r, err := NewRemote(RepositoryFixture) + c.Assert(err, IsNil) + c.Assert(r.Connect(), IsNil) + + reader, err := r.FetchDefaultBranch() + c.Assert(err, IsNil) + + pr, err := packfile.NewPackfileReader(reader, 8<<20, nil) + c.Assert(err, IsNil) + + pf, err := pr.Read() + c.Assert(err, IsNil) + c.Assert(pf.ObjectCount, Equals, 28) +} |