aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorBenjamin Ash <bash@intelerad.com>2018-10-16 15:57:12 -0400
committerBenjamin Ash <bash@intelerad.com>2018-10-16 16:16:53 -0400
commit1618e1cf321aa9cee6d0c11cb14e265b049563c4 (patch)
tree89c48506ad42b4e0baea2345cdc77d7563620ec0 /remote_test.go
parentcd64b4d630b6c2d2b3d72e9615e14f9d58bb5787 (diff)
downloadgo-git-1618e1cf321aa9cee6d0c11cb14e265b049563c4.tar.gz
remote: use reference deltas on push when the remote server does not
support offset deltas Signed-off-by: Benjamin Ash <bash@intelerad.com>
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)
+}