File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Original file line number Diff line number Diff line change @@ -151,6 +151,6 @@ GitHost.prototype.getDefaultRepresentation = function () {
151
151
}
152
152
153
153
GitHost . prototype . toString = function ( opts ) {
154
- const method = this . default || /* istanbul ignore next */ 'sshurl'
155
- return this [ method ] ( opts )
154
+ if ( this . default && typeof this [ this . default ] === 'function' ) return this [ this . default ] ( opts )
155
+ return this . sshurl ( opts )
156
156
}
Original file line number Diff line number Diff line change @@ -35,5 +35,7 @@ test('basic', function (t) {
35
35
t . is ( HostedGit . fromUrl ( 'git+file:///foo/bar' ) , undefined , 'url that has no host' )
36
36
t . is ( HostedGit . fromUrl ( 'github.com/abc/def/' ) , undefined , 'forgot the protocol' )
37
37
t . is ( HostedGit . fromUrl ( 'completely-invalid' ) , undefined , 'not a url is not hosted' )
38
+
39
+ t . is ( HostedGit . fromUrl ( 'http://github.com/foo/bar' ) . toString ( ) , 'git+ssh://git@github.com/foo/bar.git' , 'github http protocol use git+ssh urls' )
38
40
t . end ( )
39
41
} )
You can’t perform that action at this time.
0 commit comments