diff options
author | Santiago M. Mola <santi@mola.io> | 2016-12-08 12:32:05 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-12-08 12:32:05 +0100 |
commit | 45572a28635e63559dcc3b60c30c6ce09acb0a90 (patch) | |
tree | 8418db576df2a3dcc2523cfe47a3ab4eef3f5283 | |
parent | 01ea726be6ed745a21c88fd61fc5e2a62c4ceb88 (diff) | |
download | go-git-45572a28635e63559dcc3b60c30c6ce09acb0a90.tar.gz |
remote: fix Connect, returned nil error on failure. (#167)
-rw-r--r-- | remote.go | 2 | ||||
-rw-r--r-- | remote_test.go | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -51,7 +51,7 @@ func (r *Remote) Connect() error { var err error r.fetchSession, err = r.client.NewFetchPackSession(r.endpoint) if err != nil { - return nil + return err } return r.retrieveAdvertisedReferences() diff --git a/remote_test.go b/remote_test.go index acf646f..c3e86df 100644 --- a/remote_test.go +++ b/remote_test.go @@ -44,6 +44,13 @@ func (s *RemoteSuite) TestnewRemoteInvalidEndpoint(c *C) { c.Assert(err, NotNil) } +func (s *RemoteSuite) TestnewRemoteNonExistentEndpoint(c *C) { + r := newRemote(nil, nil, &config.RemoteConfig{Name: "foo", URL: "ssh://non-existent/foo.git"}) + + err := r.Connect() + c.Assert(err, NotNil) +} + func (s *RemoteSuite) TestnewRemoteInvalidSchemaEndpoint(c *C) { r := newRemote(nil, nil, &config.RemoteConfig{Name: "foo", URL: "qux://foo"}) |