aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-06 15:46:09 +0100
committerGitHub <noreply@github.com>2016-12-06 15:46:09 +0100
commit22fe81f342538ae51442a72356036768f7f1a2f9 (patch)
treeccfe9fcd48d3c8f349b42413f71f26ba23a4cba9 /remote_test.go
parent4b5849db76905830e0124b6b9f4294ee13308e0f (diff)
downloadgo-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.go26
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