diff options
Diffstat (limited to 'clients/common/common.go')
-rw-r--r-- | clients/common/common.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/clients/common/common.go b/clients/common/common.go index 460eb10..ef35440 100644 --- a/clients/common/common.go +++ b/clients/common/common.go @@ -268,8 +268,16 @@ func (r *GitUploadPackInfo) Bytes() []byte { } type GitUploadPackRequest struct { - Want []core.Hash - Have []core.Hash + Wants []core.Hash + Haves []core.Hash +} + +func (r *GitUploadPackRequest) Want(h ...core.Hash) { + r.Wants = append(r.Wants, h...) +} + +func (r *GitUploadPackRequest) Have(h ...core.Hash) { + r.Haves = append(r.Haves, h...) } func (r *GitUploadPackRequest) String() string { @@ -279,11 +287,11 @@ func (r *GitUploadPackRequest) String() string { func (r *GitUploadPackRequest) Reader() *strings.Reader { e := pktline.NewEncoder() - for _, want := range r.Want { + for _, want := range r.Wants { e.AddLine(fmt.Sprintf("want %s", want)) } - for _, have := range r.Have { + for _, have := range r.Haves { e.AddLine(fmt.Sprintf("have %s", have)) } |