diff options
author | Santiago M. Mola <santi@mola.io> | 2016-11-28 09:57:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 09:57:38 +0100 |
commit | 68893edf9ddc3de181431f1552e3b773cb66f080 (patch) | |
tree | f45e5fa18e10168a278b7d0ed7dea984ff9969f7 /common_test.go | |
parent | f9adb3565b36ba1573102f954d0ee916009efac2 (diff) | |
download | go-git-68893edf9ddc3de181431f1552e3b773cb66f080.tar.gz |
remove old types from transport and use packp (#142)
* protocol: move UploadPackRequest to protocol.
* UploadPackRequest is now defined as an embedding of UploadRequest and
UploadHaves.
* Move http encoding specific code from UploadPackRequest to transport/http.
* rename UlReq to UploadRequest
* packp: move AdvRefs Encoder/Decoder to Encode/Decode methods.
* packp: move UploadRequest Encoder/Decoder to Encode/Decode methods.
* packp: Remove transport.UploadPackInfo in favor of packp. AdvRefs.
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/common_test.go b/common_test.go index 62896a1..be86b4e 100644 --- a/common_test.go +++ b/common_test.go @@ -93,8 +93,7 @@ func (c *MockFetchPackSession) SetAuth(auth transport.AuthMethod) error { return nil } -func (c *MockFetchPackSession) AdvertisedReferences() ( - *transport.UploadPackInfo, error) { +func (c *MockFetchPackSession) AdvertisedReferences() (*packp.AdvRefs, error) { h := fixtures.ByURL(c.endpoint.String()).One().Head @@ -105,19 +104,19 @@ func (c *MockFetchPackSession) AdvertisedReferences() ( branch := plumbing.ReferenceName("refs/heads/branch") tag := plumbing.ReferenceName("refs/tags/v1.0.0") - return &transport.UploadPackInfo{ - Capabilities: cap, - Refs: map[plumbing.ReferenceName]*plumbing.Reference{ - plumbing.HEAD: plumbing.NewSymbolicReference(plumbing.HEAD, ref), - ref: plumbing.NewHashReference(ref, h), - tag: plumbing.NewHashReference(tag, h), - branch: plumbing.NewHashReference(branch, plumbing.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881")), - }, - }, nil + a := packp.NewAdvRefs() + a.Capabilities = cap + a.Head = &h + a.AddReference(plumbing.NewSymbolicReference(plumbing.HEAD, ref)) + a.AddReference(plumbing.NewHashReference(ref, h)) + a.AddReference(plumbing.NewHashReference(tag, h)) + a.AddReference(plumbing.NewHashReference(branch, plumbing.NewHash("e8d3ffab552895c19b9fcf7aa264d277cde33881"))) + + return a, nil } func (c *MockFetchPackSession) FetchPack( - r *transport.UploadPackRequest) (io.ReadCloser, error) { + r *packp.UploadPackRequest) (io.ReadCloser, error) { f := fixtures.ByURL(c.endpoint.String()) |