diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-11-05 19:08:20 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-11-05 20:55:46 +0100 |
commit | 6be0bc1233b1a31e749354f1d54104b49d5bf19b (patch) | |
tree | a9fd259944a42322050247ed6b5393150f2c4cb8 /repository.go | |
parent | a80d56b21142096f458758405736f3d567c175f5 (diff) | |
download | go-git-6be0bc1233b1a31e749354f1d54104b49d5bf19b.tar.gz |
clients: new AuthMethod and ConnectWithAuth
Diffstat (limited to 'repository.go')
-rw-r--r-- | repository.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/repository.go b/repository.go index 9bdccc0..bf45fdc 100644 --- a/repository.go +++ b/repository.go @@ -23,8 +23,16 @@ type Repository struct { } // NewRepository creates a new repository setting remote as default remote -func NewRepository(url string) (*Repository, error) { - remote, err := NewRemote(url) +func NewRepository(url string, auth common.AuthMethod) (*Repository, error) { + var remote *Remote + var err error + + if auth == nil { + remote, err = NewRemote(url) + } else { + remote, err = NewAuthenticatedRemote(url, auth) + } + if err != nil { return nil, err } |