Skip to content

Commit d9bce22

Browse files
committedNov 11, 2019
git: resolved should be a git+ssh:// url, not just ssh://
1 parent 84535a3 commit d9bce22

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎lib/git.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ const _prepareDir = Symbol('_prepareDir')
2323

2424
// get the repository url. prefer ssh, fall back to git://
2525
const repoUrl = (hosted, opts) =>
26-
hosted.sshurl && hosted.sshurl(opts) ||
26+
hosted.sshurl && addGitPlus(hosted.sshurl(opts)) ||
2727
hosted.git && hosted.git(opts)
2828

29+
const addGitPlus = url => url && `git+${url}`
30+
2931
class GitFetcher extends Fetcher {
3032
constructor (spec, opts) {
3133
super(spec, opts)

‎test/git.js

+7
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,10 @@ t.test('fetch a private repo where the tgz is not a tarball', t => {
396396
code: 'TAR_BAD_ARCHIVE',
397397
})
398398
})
399+
400+
t.test('resolved is a git+ssh url for hosted repos that support it', t => {
401+
const hash = '0000000000000000000000000000000000000000'
402+
const gf = new GitFetcher(`github:x/y#${hash}`, {})
403+
t.equal(gf.resolved, `git+ssh://git@github.com/x/y.git#${hash}`)
404+
t.end()
405+
})

0 commit comments

Comments
 (0)
Please sign in to comment.