diff options
Diffstat (limited to 'plumbing/transport/git/common.go')
-rw-r--r-- | plumbing/transport/git/common.go | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/plumbing/transport/git/common.go b/plumbing/transport/git/common.go index 8c35c19..5eae22a 100644 --- a/plumbing/transport/git/common.go +++ b/plumbing/transport/git/common.go @@ -1,7 +1,6 @@ package git import ( - "errors" "fmt" "io" "net" @@ -13,22 +12,21 @@ import ( "gopkg.in/src-d/go-git.v4/utils/ioutil" ) -var ( - errAlreadyConnected = errors.New("tcp connection already connected") -) - // DefaultClient is the default git client. var DefaultClient = common.NewClient(&runner{}) type runner struct{} // Command returns a new Command for the given cmd in the given Endpoint -func (r *runner) Command(cmd string, ep transport.Endpoint) (common.Command, error) { +func (r *runner) Command(cmd string, ep transport.Endpoint, auth transport.AuthMethod) (common.Command, error) { + // auth not allowed since git protocol doesn't support authentication + if auth != nil { + return nil, transport.ErrInvalidAuthMethod + } c := &command{command: cmd, endpoint: ep} if err := c.connect(); err != nil { return nil, err } - return c, nil } @@ -39,11 +37,6 @@ type command struct { endpoint transport.Endpoint } -// SetAuth cannot be called since git protocol doesn't support authentication -func (c *command) SetAuth(auth transport.AuthMethod) error { - return transport.ErrInvalidAuthMethod -} - // Start executes the command sending the required message to the TCP connection func (c *command) Start() error { cmd := endpointToCommand(c.command, c.endpoint) @@ -54,7 +47,7 @@ func (c *command) Start() error { func (c *command) connect() error { if c.connected { - return errAlreadyConnected + return transport.ErrAlreadyConnected } var err error |