diff options
Diffstat (limited to 'plumbing/protocol/packp/ulreq.go')
-rw-r--r-- | plumbing/protocol/packp/ulreq.go | 16 |
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...) +} |