diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-04-21 14:19:38 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-04-21 14:19:38 +0200 |
commit | fa9dd838ee89eaff543cdd81e7c97c842f982538 (patch) | |
tree | 53129d025576839dea70196b8dc99d35d9dfcb8d /plumbing | |
parent | d32489902e86c6b667bbc4d28558ebd40a80cf4a (diff) | |
download | go-git-fa9dd838ee89eaff543cdd81e7c97c842f982538.tar.gz |
transport: ssh, new DefaultAuthBuilder variable
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/transport/ssh/common.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go index 9b484f9..7b44a91 100644 --- a/plumbing/transport/ssh/common.go +++ b/plumbing/transport/ssh/common.go @@ -14,6 +14,12 @@ import ( // DefaultClient is the default SSH client. var DefaultClient = common.NewClient(&runner{}) +// DefaultAuthBuilder is the function used to create a default AuthMethod, when +// the user doesn't provide any. +var DefaultAuthBuilder = func(user string) (AuthMethod, error) { + return NewSSHAgentAuth(user) +} + type runner struct{} func (r *runner) Command(cmd string, ep transport.Endpoint, auth transport.AuthMethod) (common.Command, error) { @@ -119,7 +125,7 @@ func (c *command) setAuthFromEndpoint() error { } var err error - c.auth, err = NewSSHAgentAuth(u) + c.auth, err = DefaultAuthBuilder(u) return err } |