Skip to content

Commit

Permalink
fix(git): Fix gitRange for git+ssh for private git (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreeib authored and zkat committed Apr 10, 2018
1 parent 8425a96 commit 647a0b3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion npa.js
Expand Up @@ -231,8 +231,8 @@ function fromURL (res) {
res.type = 'git'
const match = urlparse.protocol === 'git+ssh:' && matchGitScp(res.rawSpec)
if (match) {
setGitCommittish(res, match.gitCommittish)
res.fetchSpec = match.fetchSpec
res.gitCommittish = match.gitCommittish
} else {
setGitCommittish(res, urlparse.hash != null ? urlparse.hash.slice(1) : '')
urlparse.protocol = urlparse.protocol.replace(/^git[+]/, '')
Expand Down
23 changes: 23 additions & 0 deletions test/basic.js
Expand Up @@ -220,6 +220,18 @@ require('tap').test('basic', function (t) {
raw: 'git+ssh://git@notgithub.com/user/foo#semver:^1.2.3'
},

'git+ssh://git@notgithub.com:user/foo#semver:^1.2.3': {
name: null,
escapedName: null,
type: 'git',
hosted: null,
saveSpec: 'git+ssh://git@notgithub.com:user/foo#semver:^1.2.3',
fetchSpec: 'git@notgithub.com:user/foo',
gitCommittish: null,
gitRange: '^1.2.3',
raw: 'git+ssh://git@notgithub.com:user/foo#semver:^1.2.3'
},

'git+ssh://git@github.com/user/foo#semver:^1.2.3': {
name: null,
escapedName: null,
Expand All @@ -231,6 +243,17 @@ require('tap').test('basic', function (t) {
raw: 'git+ssh://git@github.com/user/foo#semver:^1.2.3'
},

'git+ssh://git@github.com:user/foo#semver:^1.2.3': {
name: null,
escapedName: null,
type: 'git',
saveSpec: 'git+ssh://git@github.com/user/foo.git#semver:^1.2.3',
fetchSpec: 'ssh://git@github.com/user/foo.git',
gitCommittish: null,
gitRange: '^1.2.3',
raw: 'git+ssh://git@github.com:user/foo#semver:^1.2.3'
},

'user/foo#semver:^1.2.3': {
name: null,
escapedName: null,
Expand Down

0 comments on commit 647a0b3

Please sign in to comment.