aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/gitproto.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/protocol/packp/gitproto.go')
-rw-r--r--plumbing/protocol/packp/gitproto.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/plumbing/protocol/packp/gitproto.go b/plumbing/protocol/packp/gitproto.go
index 806e44c..0b7ff8f 100644
--- a/plumbing/protocol/packp/gitproto.go
+++ b/plumbing/protocol/packp/gitproto.go
@@ -76,7 +76,11 @@ func (g *GitProtoRequest) Encode(w io.Writer) error {
func (g *GitProtoRequest) Decode(r io.Reader) error {
s := pktline.NewScanner(r)
if !s.Scan() {
- return s.Err()
+ err := s.Err()
+ if err == nil {
+ return ErrInvalidGitProtoRequest
+ }
+ return err
}
line := string(s.Bytes())
@@ -99,8 +103,9 @@ func (g *GitProtoRequest) Decode(r io.Reader) error {
return fmt.Errorf("%w: missing pathname", ErrInvalidGitProtoRequest)
}
+ g.Pathname = params[0]
if len(params) > 1 {
- g.Host = params[1]
+ g.Host = strings.TrimPrefix(params[1], "host=")
}
if len(params) > 2 {