aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2020-07-06 16:50:56 +0200
committerOleg Kovalov <iamolegkovalov@gmail.com>2020-07-06 16:50:56 +0200
commitd07f2fbd7f615707c5f8b4bde32d5824c4196411 (patch)
tree471dd4e02088750aeb4adfab85a3c74b5052c1fc /plumbing/protocol/packp
parenta9899594dfdde8bbfdf35fc7e8c2fc3ec5aa7fdb (diff)
downloadgo-git-d07f2fbd7f615707c5f8b4bde32d5824c4196411.tar.gz
Use only one name for receiver
Diffstat (limited to 'plumbing/protocol/packp')
-rw-r--r--plumbing/protocol/packp/ulreq.go32
-rw-r--r--plumbing/protocol/packp/ulreq_decode.go4
-rw-r--r--plumbing/protocol/packp/ulreq_encode.go4
-rw-r--r--plumbing/protocol/packp/updreq.go6
-rw-r--r--plumbing/protocol/packp/updreq_encode.go18
5 files changed, 32 insertions, 32 deletions
diff --git a/plumbing/protocol/packp/ulreq.go b/plumbing/protocol/packp/ulreq.go
index 44db8e4..ddec06e 100644
--- a/plumbing/protocol/packp/ulreq.go
+++ b/plumbing/protocol/packp/ulreq.go
@@ -109,42 +109,42 @@ func NewUploadRequestFromCapabilities(adv *capability.List) *UploadRequest {
// - is a DepthReference is given capability.DeepenNot MUST be present
// - MUST contain only maximum of one of capability.Sideband and capability.Sideband64k
// - MUST contain only maximum of one of capability.MultiACK and capability.MultiACKDetailed
-func (r *UploadRequest) Validate() error {
- if len(r.Wants) == 0 {
+func (req *UploadRequest) Validate() error {
+ if len(req.Wants) == 0 {
return fmt.Errorf("want can't be empty")
}
- if err := r.validateRequiredCapabilities(); err != nil {
+ if err := req.validateRequiredCapabilities(); err != nil {
return err
}
- if err := r.validateConflictCapabilities(); err != nil {
+ if err := req.validateConflictCapabilities(); err != nil {
return err
}
return nil
}
-func (r *UploadRequest) validateRequiredCapabilities() error {
+func (req *UploadRequest) validateRequiredCapabilities() error {
msg := "missing capability %s"
- if len(r.Shallows) != 0 && !r.Capabilities.Supports(capability.Shallow) {
+ if len(req.Shallows) != 0 && !req.Capabilities.Supports(capability.Shallow) {
return fmt.Errorf(msg, capability.Shallow)
}
- switch r.Depth.(type) {
+ switch req.Depth.(type) {
case DepthCommits:
- if r.Depth != DepthCommits(0) {
- if !r.Capabilities.Supports(capability.Shallow) {
+ if req.Depth != DepthCommits(0) {
+ if !req.Capabilities.Supports(capability.Shallow) {
return fmt.Errorf(msg, capability.Shallow)
}
}
case DepthSince:
- if !r.Capabilities.Supports(capability.DeepenSince) {
+ if !req.Capabilities.Supports(capability.DeepenSince) {
return fmt.Errorf(msg, capability.DeepenSince)
}
case DepthReference:
- if !r.Capabilities.Supports(capability.DeepenNot) {
+ if !req.Capabilities.Supports(capability.DeepenNot) {
return fmt.Errorf(msg, capability.DeepenNot)
}
}
@@ -152,15 +152,15 @@ func (r *UploadRequest) validateRequiredCapabilities() error {
return nil
}
-func (r *UploadRequest) validateConflictCapabilities() error {
+func (req *UploadRequest) validateConflictCapabilities() error {
msg := "capabilities %s and %s are mutually exclusive"
- if r.Capabilities.Supports(capability.Sideband) &&
- r.Capabilities.Supports(capability.Sideband64k) {
+ if req.Capabilities.Supports(capability.Sideband) &&
+ req.Capabilities.Supports(capability.Sideband64k) {
return fmt.Errorf(msg, capability.Sideband, capability.Sideband64k)
}
- if r.Capabilities.Supports(capability.MultiACK) &&
- r.Capabilities.Supports(capability.MultiACKDetailed) {
+ if req.Capabilities.Supports(capability.MultiACK) &&
+ req.Capabilities.Supports(capability.MultiACKDetailed) {
return fmt.Errorf(msg, capability.MultiACK, capability.MultiACKDetailed)
}
diff --git a/plumbing/protocol/packp/ulreq_decode.go b/plumbing/protocol/packp/ulreq_decode.go
index 449b729..895a3bf 100644
--- a/plumbing/protocol/packp/ulreq_decode.go
+++ b/plumbing/protocol/packp/ulreq_decode.go
@@ -14,9 +14,9 @@ import (
// Decode reads the next upload-request form its input and
// stores it in the UploadRequest.
-func (u *UploadRequest) Decode(r io.Reader) error {
+func (req *UploadRequest) Decode(r io.Reader) error {
d := newUlReqDecoder(r)
- return d.Decode(u)
+ return d.Decode(req)
}
type ulReqDecoder struct {
diff --git a/plumbing/protocol/packp/ulreq_encode.go b/plumbing/protocol/packp/ulreq_encode.go
index 4863076..c451e23 100644
--- a/plumbing/protocol/packp/ulreq_encode.go
+++ b/plumbing/protocol/packp/ulreq_encode.go
@@ -15,9 +15,9 @@ import (
// All the payloads will end with a newline character. Wants and
// shallows are sorted alphabetically. A depth of 0 means no depth
// request is sent.
-func (u *UploadRequest) Encode(w io.Writer) error {
+func (req *UploadRequest) Encode(w io.Writer) error {
e := newUlReqEncoder(w)
- return e.Encode(u)
+ return e.Encode(req)
}
type ulReqEncoder struct {
diff --git a/plumbing/protocol/packp/updreq.go b/plumbing/protocol/packp/updreq.go
index b63b023..4d927d8 100644
--- a/plumbing/protocol/packp/updreq.go
+++ b/plumbing/protocol/packp/updreq.go
@@ -68,12 +68,12 @@ func NewReferenceUpdateRequestFromCapabilities(adv *capability.List) *ReferenceU
return r
}
-func (r *ReferenceUpdateRequest) validate() error {
- if len(r.Commands) == 0 {
+func (req *ReferenceUpdateRequest) validate() error {
+ if len(req.Commands) == 0 {
return ErrEmptyCommands
}
- for _, c := range r.Commands {
+ for _, c := range req.Commands {
if err := c.validate(); err != nil {
return err
}
diff --git a/plumbing/protocol/packp/updreq_encode.go b/plumbing/protocol/packp/updreq_encode.go
index 6a79653..2545e93 100644
--- a/plumbing/protocol/packp/updreq_encode.go
+++ b/plumbing/protocol/packp/updreq_encode.go
@@ -14,33 +14,33 @@ var (
)
// Encode writes the ReferenceUpdateRequest encoding to the stream.
-func (r *ReferenceUpdateRequest) Encode(w io.Writer) error {
- if err := r.validate(); err != nil {
+func (req *ReferenceUpdateRequest) Encode(w io.Writer) error {
+ if err := req.validate(); err != nil {
return err
}
e := pktline.NewEncoder(w)
- if err := r.encodeShallow(e, r.Shallow); err != nil {
+ if err := req.encodeShallow(e, req.Shallow); err != nil {
return err
}
- if err := r.encodeCommands(e, r.Commands, r.Capabilities); err != nil {
+ if err := req.encodeCommands(e, req.Commands, req.Capabilities); err != nil {
return err
}
- if r.Packfile != nil {
- if _, err := io.Copy(w, r.Packfile); err != nil {
+ if req.Packfile != nil {
+ if _, err := io.Copy(w, req.Packfile); err != nil {
return err
}
- return r.Packfile.Close()
+ return req.Packfile.Close()
}
return nil
}
-func (r *ReferenceUpdateRequest) encodeShallow(e *pktline.Encoder,
+func (req *ReferenceUpdateRequest) encodeShallow(e *pktline.Encoder,
h *plumbing.Hash) error {
if h == nil {
@@ -51,7 +51,7 @@ func (r *ReferenceUpdateRequest) encodeShallow(e *pktline.Encoder,
return e.Encodef("%s%s", shallow, objId)
}
-func (r *ReferenceUpdateRequest) encodeCommands(e *pktline.Encoder,
+func (req *ReferenceUpdateRequest) encodeCommands(e *pktline.Encoder,
cmds []*Command, cap *capability.List) error {
if err := e.Encodef("%s\x00%s",