Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

protocol/packp: capabilities new Capability entity and List struct, test improvements #144

Merged
merged 4 commits into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"gopkg.in/src-d/go-git.v4/fixtures"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/format/packfile"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
"gopkg.in/src-d/go-git.v4/plumbing/transport/client"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
Expand Down Expand Up @@ -98,7 +98,7 @@ func (c *MockFetchPackSession) AdvertisedReferences() (

h := fixtures.ByURL(c.endpoint.String()).One().Head

cap := packp.NewCapabilities()
cap := capability.NewList()
cap.Decode("6ecf0ef2c2dffb796033e5a02219af86ec6584e5 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.4.8~dbussink-fix-enterprise-tokens-compilation-1167-gc7006cf")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decode method changes his input param type from string to byte[].


ref := plumbing.ReferenceName("refs/heads/master")
Expand Down
5 changes: 3 additions & 2 deletions plumbing/protocol/packp/advrefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package packp

import (
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
)

// AdvRefs values represent the information transmitted on an
Expand All @@ -22,7 +23,7 @@ import (
type AdvRefs struct {
Prefix [][]byte // payloads of the prefix
Head *plumbing.Hash
Capabilities *Capabilities
Capabilities *capability.List
References map[string]plumbing.Hash
Peeled map[string]plumbing.Hash
Shallows []plumbing.Hash
Expand All @@ -32,7 +33,7 @@ type AdvRefs struct {
func NewAdvRefs() *AdvRefs {
return &AdvRefs{
Prefix: [][]byte{},
Capabilities: NewCapabilities(),
Capabilities: capability.NewList(),
References: make(map[string]plumbing.Hash),
Peeled: make(map[string]plumbing.Hash),
Shallows: []plumbing.Hash{},
Expand Down
5 changes: 2 additions & 3 deletions plumbing/protocol/packp/advrefs_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ func decodeCaps(p *AdvRefsDecoder) decoderStateFn {
return decodeOtherRefs
}

for _, c := range bytes.Split(p.line, sp) {
name, values := readCapability(c)
p.data.Capabilities.Add(name, values...)
if err := p.data.Capabilities.Decode(p.line); err != nil {
p.error("invalid capabilities: %s", err)
}

return decodeOtherRefs
Expand Down
Loading