aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/ulreq.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-11-28 09:57:38 +0100
committerGitHub <noreply@github.com>2016-11-28 09:57:38 +0100
commit68893edf9ddc3de181431f1552e3b773cb66f080 (patch)
treef45e5fa18e10168a278b7d0ed7dea984ff9969f7 /plumbing/protocol/packp/ulreq.go
parentf9adb3565b36ba1573102f954d0ee916009efac2 (diff)
downloadgo-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 'plumbing/protocol/packp/ulreq.go')
-rw-r--r--plumbing/protocol/packp/ulreq.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/plumbing/protocol/packp/ulreq.go b/plumbing/protocol/packp/ulreq.go
index 5870001..6ec5b96 100644
--- a/plumbing/protocol/packp/ulreq.go
+++ b/plumbing/protocol/packp/ulreq.go
@@ -6,10 +6,11 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
)
-// UlReq values represent the information transmitted on a
+// UploadRequest values represent the information transmitted on a
// upload-request message. Values from this type are not zero-value
// safe, use the New function instead.
-type UlReq struct {
+// This is a low level type, use UploadPackRequest instead.
+type UploadRequest struct {
Capabilities *Capabilities
Wants []plumbing.Hash
Shallows []plumbing.Hash
@@ -39,15 +40,20 @@ type DepthReference string
func (d DepthReference) isDepth() {}
-// NewUlReq returns a pointer to a new UlReq value, ready to be used. It has
+// NewUploadRequest returns a pointer to a new UlReq value, ready to be used. It has
// no capabilities, wants or shallows and an infinite depth. Please
// note that to encode an upload-request it has to have at least one
// wanted hash.
-func NewUlReq() *UlReq {
- return &UlReq{
+func NewUploadRequest() *UploadRequest {
+ return &UploadRequest{
Capabilities: NewCapabilities(),
Wants: []plumbing.Hash{},
Shallows: []plumbing.Hash{},
Depth: DepthCommits(0),
}
}
+
+// Want adds a hash reference to the 'wants' list.
+func (r *UploadRequest) Want(h ...plumbing.Hash) {
+ r.Wants = append(r.Wants, h...)
+}