Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 45572a2

Browse files
smolamcuadros
authored andcommitted
remote: fix Connect, returned nil error on failure. (#167)
1 parent 01ea726 commit 45572a2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

remote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (r *Remote) Connect() error {
5151
var err error
5252
r.fetchSession, err = r.client.NewFetchPackSession(r.endpoint)
5353
if err != nil {
54-
return nil
54+
return err
5555
}
5656

5757
return r.retrieveAdvertisedReferences()

remote_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ func (s *RemoteSuite) TestnewRemoteInvalidEndpoint(c *C) {
4444
c.Assert(err, NotNil)
4545
}
4646

47+
func (s *RemoteSuite) TestnewRemoteNonExistentEndpoint(c *C) {
48+
r := newRemote(nil, nil, &config.RemoteConfig{Name: "foo", URL: "ssh://non-existent/foo.git"})
49+
50+
err := r.Connect()
51+
c.Assert(err, NotNil)
52+
}
53+
4754
func (s *RemoteSuite) TestnewRemoteInvalidSchemaEndpoint(c *C) {
4855
r := newRemote(nil, nil, &config.RemoteConfig{Name: "foo", URL: "qux://foo"})
4956

0 commit comments

Comments
 (0)