Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions git-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ GitHost.prototype.getDefaultRepresentation = function () {
}

GitHost.prototype.toString = function (opts) {
const method = this.default || /* istanbul ignore next */ 'sshurl'
return this[method](opts)
if (this.default && typeof this[this.default] === 'function') return this[this.default](opts)
return this.sshurl(opts)
}
2 changes: 2 additions & 0 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@ test('basic', function (t) {
t.is(HostedGit.fromUrl('git+file:///foo/bar'), undefined, 'url that has no host')
t.is(HostedGit.fromUrl('github.com/abc/def/'), undefined, 'forgot the protocol')
t.is(HostedGit.fromUrl('completely-invalid'), undefined, 'not a url is not hosted')

t.is(HostedGit.fromUrl('http://github.com/foo/bar').toString(), 'git+ssh://[email protected]/foo/bar.git', 'github http protocol use git+ssh urls')
t.end()
})