aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2018-10-17 12:01:47 +0200
committerGitHub <noreply@github.com>2018-10-17 12:01:47 +0200
commitf2a7dad17c6fdc7e6c9a99bac8a6d09ec1c71c01 (patch)
treeadfe885d83e3a33003e7f4c37ec29077c0002cfe /remote_test.go
parent1a2248b4463cfd4c0e7377150448069d1969fc22 (diff)
parent1618e1cf321aa9cee6d0c11cb14e265b049563c4 (diff)
downloadgo-git-f2a7dad17c6fdc7e6c9a99bac8a6d09ec1c71c01.tar.gz
Merge pull request #987 from bashims/945-push-ref-deltas
remote: use reference deltas on push when the remote server does not …
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go
index 175faed..28b0a3a 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -11,6 +11,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/cache"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp"
+ "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
@@ -798,3 +799,25 @@ func (s *RemoteSuite) TestUpdateShallows(c *C) {
c.Assert(shallow, DeepEquals, t.result)
}
}
+
+func (s *RemoteSuite) TestUseRefDeltas(c *C) {
+ url := c.MkDir()
+ _, err := PlainInit(url, true)
+ c.Assert(err, IsNil)
+
+ fs := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One().DotGit()
+ sto := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
+
+ r := newRemote(sto, &config.RemoteConfig{
+ Name: DefaultRemoteName,
+ URLs: []string{url},
+ })
+
+ ar := packp.NewAdvRefs()
+
+ ar.Capabilities.Add(capability.OFSDelta)
+ c.Assert(r.useRefDeltas(ar), Equals, false)
+
+ ar.Capabilities.Delete(capability.OFSDelta)
+ c.Assert(r.useRefDeltas(ar), Equals, true)
+}