aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/capability
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/protocol/packp/capability')
-rw-r--r--plumbing/protocol/packp/capability/list.go6
-rw-r--r--plumbing/protocol/packp/capability/list_test.go10
2 files changed, 6 insertions, 10 deletions
diff --git a/plumbing/protocol/packp/capability/list.go b/plumbing/protocol/packp/capability/list.go
index 69fdb51..3904a4e 100644
--- a/plumbing/protocol/packp/capability/list.go
+++ b/plumbing/protocol/packp/capability/list.go
@@ -8,8 +8,6 @@ import (
)
var (
- // ErrUnknownCapability is returned if a unknown capability is given
- ErrUnknownCapability = errors.New("unknown capability")
// ErrArgumentsRequired is returned if no arguments are giving with a
// capability that requires arguments
ErrArgumentsRequired = errors.New("arguments required")
@@ -119,10 +117,6 @@ func (l *List) Add(c Capability, values ...string) error {
}
func (l *List) validate(c Capability, values []string) error {
- if _, ok := valid[c]; !ok {
- return ErrUnknownCapability
- }
-
if requiresArgument[c] && len(values) == 0 {
return ErrArgumentsRequired
}
diff --git a/plumbing/protocol/packp/capability/list_test.go b/plumbing/protocol/packp/capability/list_test.go
index 0a0ad26..9665e89 100644
--- a/plumbing/protocol/packp/capability/list_test.go
+++ b/plumbing/protocol/packp/capability/list_test.go
@@ -58,10 +58,11 @@ func (s *SuiteCapabilities) TestDecodeWithEqual(c *check.C) {
c.Assert(cap.Get(Agent), check.DeepEquals, []string{"foo=bar"})
}
-func (s *SuiteCapabilities) TestDecodeWithErrUnknownCapability(c *check.C) {
+func (s *SuiteCapabilities) TestDecodeWithUnknownCapability(c *check.C) {
cap := NewList()
err := cap.Decode([]byte("foo"))
- c.Assert(err, check.Equals, ErrUnknownCapability)
+ c.Assert(err, check.IsNil)
+ c.Assert(cap.Supports(Capability("foo")), check.Equals, true)
}
func (s *SuiteCapabilities) TestString(c *check.C) {
@@ -133,10 +134,11 @@ func (s *SuiteCapabilities) TestAdd(c *check.C) {
c.Assert(cap.String(), check.Equals, "symref=foo symref=qux thin-pack")
}
-func (s *SuiteCapabilities) TestAddErrUnknownCapability(c *check.C) {
+func (s *SuiteCapabilities) TestAddUnknownCapability(c *check.C) {
cap := NewList()
err := cap.Add(Capability("foo"))
- c.Assert(err, check.Equals, ErrUnknownCapability)
+ c.Assert(err, check.IsNil)
+ c.Assert(cap.Supports(Capability("foo")), check.Equals, true)
}
func (s *SuiteCapabilities) TestAddErrArgumentsRequired(c *check.C) {