Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3b1d629

Browse filesBrowse files
fengmk2isaacs
authored andcommitted
fix: http protocol use sshurl by default
PR-URL: #48 Credit: @fengmk2 Close: #48 Reviewed-by: @isaacs
1 parent 2d5aa25 commit 3b1d629
Copy full SHA for 3b1d629

File tree

Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-2
lines changed

‎git-host.js

Copy file name to clipboardExpand all lines: git-host.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,6 @@ GitHost.prototype.getDefaultRepresentation = function () {
151151
}
152152

153153
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)
156156
}

‎test/basic.js

Copy file name to clipboardExpand all lines: test/basic.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ test('basic', function (t) {
3535
t.is(HostedGit.fromUrl('git+file:///foo/bar'), undefined, 'url that has no host')
3636
t.is(HostedGit.fromUrl('github.com/abc/def/'), undefined, 'forgot the protocol')
3737
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')
3840
t.end()
3941
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.