From 6593c757346f9817a770ff0ea091cce3e8243070 Mon Sep 17 00:00:00 2001 From: Anthony Weems Date: Tue, 17 Jan 2017 11:17:11 -0600 Subject: transport: remove SetAuth, fixes #206 (#210) * remove SetAuth functions, implement at NewUploadPackSession/NewReceivePackSession level. * propagate transport.Auth from Fetch/Pull/Clone options to the transport API. --- remote.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'remote.go') diff --git a/remote.go b/remote.go index c3fa042..a071b07 100644 --- a/remote.go +++ b/remote.go @@ -72,7 +72,7 @@ func (r *Remote) Push(o *PushOptions) (err error) { return fmt.Errorf("remote names don't match: %s != %s", o.RemoteName, r.c.Name) } - s, err := newSendPackSession(r.c.URL) + s, err := newSendPackSession(r.c.URL, o.Auth) if err != nil { return err } @@ -132,7 +132,7 @@ func (r *Remote) fetch(o *FetchOptions) (refs storer.ReferenceStorer, err error) o.RefSpecs = r.c.Fetch } - s, err := newUploadPackSession(r.c.URL) + s, err := newUploadPackSession(r.c.URL, o.Auth) if err != nil { return nil, err } @@ -175,22 +175,22 @@ func (r *Remote) fetch(o *FetchOptions) (refs storer.ReferenceStorer, err error) return remoteRefs, err } -func newUploadPackSession(url string) (transport.UploadPackSession, error) { +func newUploadPackSession(url string, auth transport.AuthMethod) (transport.UploadPackSession, error) { c, ep, err := newClient(url) if err != nil { return nil, err } - return c.NewUploadPackSession(ep) + return c.NewUploadPackSession(ep, auth) } -func newSendPackSession(url string) (transport.ReceivePackSession, error) { +func newSendPackSession(url string, auth transport.AuthMethod) (transport.ReceivePackSession, error) { c, ep, err := newClient(url) if err != nil { return nil, err } - return c.NewReceivePackSession(ep) + return c.NewReceivePackSession(ep, auth) } func newClient(url string) (transport.Transport, transport.Endpoint, error) { -- cgit