diff options
author | Benjamin Ash <bash@intelerad.com> | 2018-10-16 15:57:12 -0400 |
---|---|---|
committer | Benjamin Ash <bash@intelerad.com> | 2018-10-16 16:16:53 -0400 |
commit | 1618e1cf321aa9cee6d0c11cb14e265b049563c4 (patch) | |
tree | 89c48506ad42b4e0baea2345cdc77d7563620ec0 /remote_test.go | |
parent | cd64b4d630b6c2d2b3d72e9615e14f9d58bb5787 (diff) | |
download | go-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.go | 23 |
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) +} |