diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-12-06 15:46:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-06 15:46:09 +0100 |
commit | 22fe81f342538ae51442a72356036768f7f1a2f9 (patch) | |
tree | ccfe9fcd48d3c8f349b42413f71f26ba23a4cba9 /remote_test.go | |
parent | 4b5849db76905830e0124b6b9f4294ee13308e0f (diff) | |
download | go-git-22fe81f342538ae51442a72356036768f7f1a2f9.tar.gz |
protocol/packp: UploadPackResponse implementation (#161)
* plumbing/protocol: paktp avoid duplication of haves, wants and shallow
* protocol/pakp: UploadPackResponse implementation
* changes
* changes
* changes
* debug
* changes
Diffstat (limited to 'remote_test.go')
-rw-r--r-- | remote_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go index 7c714e9..30f68ad 100644 --- a/remote_test.go +++ b/remote_test.go @@ -98,6 +98,32 @@ func (s *RemoteSuite) TestFetch(c *C) { } } +func (s *RemoteSuite) TestFetchDepth(c *C) { + url := s.GetBasicLocalRepositoryURL() + sto := memory.NewStorage() + r := newRemote(sto, &config.RemoteConfig{Name: "foo", URL: url}) + c.Assert(r.Connect(), IsNil) + + refspec := config.RefSpec("+refs/heads/*:refs/remotes/origin/*") + err := r.Fetch(&FetchOptions{ + RefSpecs: []config.RefSpec{refspec}, + Depth: 1, + }) + + c.Assert(err, IsNil) + c.Assert(sto.Objects, HasLen, 18) + + expectedRefs := []*plumbing.Reference{ + plumbing.NewReferenceFromStrings("refs/remotes/origin/master", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5"), + plumbing.NewReferenceFromStrings("refs/remotes/origin/branch", "e8d3ffab552895c19b9fcf7aa264d277cde33881"), + } + + for _, exp := range expectedRefs { + r, _ := sto.Reference(exp.Name()) + c.Assert(exp.String(), Equals, r.String()) + } +} + type mockPackfileWriter struct { Storer PackfileWriterCalled bool |