aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorJeremy Stribling <strib@alum.mit.edu>2017-10-02 14:31:37 -0700
committerJeremy Stribling <strib@alum.mit.edu>2017-10-05 19:59:25 -0700
commit39853aab188cb0b7e7c31c99b82149684df9a33c (patch)
treeb6b324fd90f60633035ee35e3cb958ee86453b4e /remote_test.go
parenta99c1291da1bf5c4ae8fada815231922f106bb70 (diff)
downloadgo-git-39853aab188cb0b7e7c31c99b82149684df9a33c.tar.gz
remote: add the last 100 commits for each ref in haves list
If the local ref is not an ancestor of the remote ref being fetched, then when we send an UploadPack request with that local ref as one of the Haves, the remote will not recognize it, and will think we are asking for the entire history of the repo, even if there's a common ancestor. To do this right, we need to support the multi-ack protocol so we can negotiate a common commit. That's hard though; this is a quick fix just to include the previous 100 commits for each local ref in the Haves list, and hope that one of them is the common commit.
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/remote_test.go b/remote_test.go
index 2b8680d..a38675a 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -625,6 +625,10 @@ func (s *RemoteSuite) TestPushWrongRemoteName(c *C) {
}
func (s *RemoteSuite) TestGetHaves(c *C) {
+ f := fixtures.Basic().One()
+ sto, err := filesystem.NewStorage(f.DotGit())
+ c.Assert(err, IsNil)
+
var localRefs = []*plumbing.Reference{
plumbing.NewReferenceFromStrings(
"foo",
@@ -640,7 +644,7 @@ func (s *RemoteSuite) TestGetHaves(c *C) {
),
}
- l, err := getHaves(localRefs)
+ l, err := getHaves(localRefs, memory.NewStorage(), sto)
c.Assert(err, IsNil)
c.Assert(l, HasLen, 2)
}