// NewClient returns a new local client using the given git-upload-pack and // git-receive-pack binaries. func NewClient(uploadPackBin, receivePackBin string) transport.Client { return common.NewClient(&runner{ UploadPackBin: uploadPackBin, ReceivePackBin: receivePackBin, }) }
"errors" "fmt" "strings" "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common" "golang.org/x/crypto/ssh" ) var ( errAlreadyConnected = errors.New("ssh session already created") ) // DefaultClient is the default SSH client. var DefaultClient = common.NewClient(&runner{}) type runner struct{} func (r *runner) Command(cmd string, ep transport.Endpoint) (common.Command, error) { c := &command{command: cmd, endpoint: ep} if err := c.connect(); err != nil { return nil, err } return c, nil } type command struct { *ssh.Session connected bool