Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: http protocol use sshurl by default #48

Closed
wants to merge 1 commit into from
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://git@github.com/foo/bar.git', 'github http protocol use git+ssh urls')
t.end()
})