Skip to content
Open
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
2 changes: 1 addition & 1 deletion tap-snapshots/test/lib/commands/ls.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ print-deduped-symlinks@1.0.0 {CWD}/prefix

exports[`test/lib/commands/ls.js TAP ls resolved points to git ref > should output tree containing git refs 1`] = `
test-npm-ls@1.0.0 {CWD}/prefix
\`-- abbrev@1.1.1 (git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c)
\`-- abbrev@1.1.1 (git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c)
`

exports[`test/lib/commands/ls.js TAP ls unmet optional dep > should output tree with empty entry for missing optional deps 1`] = `
Expand Down
2 changes: 1 addition & 1 deletion test/lib/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -4225,7 +4225,7 @@ t.test('ls --json', async t => {
abbrev: {
version: '1.1.1',
overridden: false,
resolved: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
resolved: 'git+https://github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ module.exports = cls => class Reifier extends cls {
// save the git+https url if it has auth; otherwise, shortcut
const h = req.hosted
const opt = { noCommittish: false }
if (h.https && h.auth) {
if (h.https && (h.auth || h.default === 'https')) {
newSpec = `git+${h.https(opt)}`
} else {
newSpec = h.shortcut(opt)
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/consistent-resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const consistentResolve = (resolved, fromPath, toPath, relPaths = false) => {
return `file:${fetchSpec}`
}
if (hosted) {
return `git+${hosted.auth ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)}`
return `git+${(hosted.auth || hosted.default === 'https') ? hosted.https(hostedOpt) : hosted.sshurl(hostedOpt)}`
}
if (type === 'git') {
return saveSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ ArboristNode {
"name": "full-git-url",
"packageName": "abbrev",
"path": "install-types/node_modules/full-git-url",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"version": "1.1.1",
},
"ghshort" => ArboristNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13531,7 +13531,7 @@ ArboristNode {
"location": "node_modules/full-git-url",
"name": "full-git-url",
"path": "{CWD}/test/fixtures/install-types/node_modules/full-git-url",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
},
"ghshort" => ArboristNode {
"edgesIn": Set {
Expand Down Expand Up @@ -14220,7 +14220,7 @@ ArboristNode {
"location": "node_modules/full-git-url",
"name": "full-git-url",
"path": "{CWD}/test/fixtures/install-types/node_modules/full-git-url",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
},
"ghshort" => ArboristNode {
"edgesIn": Set {
Expand Down Expand Up @@ -14909,7 +14909,7 @@ ArboristNode {
"location": "node_modules/full-git-url",
"name": "full-git-url",
"path": "{CWD}/test/arborist/tap-testdir-load-virtual-load-from-npm-shrinkwrap.json/node_modules/full-git-url",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
},
"ghshort" => ArboristNode {
"edgesIn": Set {
Expand Down Expand Up @@ -15562,7 +15562,7 @@ ArboristNode {
"location": "node_modules/full-git-url",
"name": "full-git-url",
"path": "{CWD}/test/fixtures/install-types-sw-only/node_modules/full-git-url",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
},
"ghshort" => ArboristNode {
"location": "node_modules/ghshort",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ Object {
"version": "1.0.0",
},
"node_modules/full-git-url": Object {
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
},
"node_modules/ghshort": Object {
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
Expand Down Expand Up @@ -1686,7 +1686,7 @@ Object {
"node_modules/full-git-url": Object {
"license": "ISC",
"name": "abbrev",
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"version": "1.1.1",
},
"node_modules/ghshort": Object {
Expand Down Expand Up @@ -9925,7 +9925,7 @@ Object {

exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > full git 1`] = `
Object {
"resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
"resolved": "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
}
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fs.realpath@^1.0.0:

"full-git-url@git+https://github.com/isaacs/abbrev-js.git":
version "1.1.1"
resolved "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb"
resolved "git+https://github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb"

"ghshort@github:isaacs/abbrev-js":
version "1.1.1"
Expand Down
51 changes: 26 additions & 25 deletions workspaces/arborist/test/consistent-resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,36 @@ t.test('file and directories made consistent if toPath not set', t => {
})

t.test('consistent hosted git info urls', t => {
const expect = 'git+ssh://git@github.com/a/b.git'
const expectSsh = 'git+ssh://git@github.com/a/b.git'
const expectHttps = 'git+https://github.com/a/b.git'
const expectAuth = 'git+https://user:pass@github.com/a/b.git'
t.equal(cr('a/b'), expect)
t.equal(cr('github:a/b'), expect)
t.equal(cr('git+https://github.com/a/b'), expect)
t.equal(cr('git://github.com/a/b'), expect)
t.equal(cr('git+ssh://git@github.com/a/b'), expect)
t.equal(cr('git+https://github.com/a/b.git'), expect)
t.equal(cr('git://github.com/a/b.git'), expect)
t.equal(cr('git+ssh://git@github.com/a/b.git'), expect)
t.equal(cr('a/b'), expectSsh)
t.equal(cr('github:a/b'), expectSsh)
t.equal(cr('git+https://github.com/a/b'), expectHttps)
t.equal(cr('git://github.com/a/b'), expectSsh)
t.equal(cr('git+ssh://git@github.com/a/b'), expectSsh)
t.equal(cr('git+https://github.com/a/b.git'), expectHttps)
t.equal(cr('git://github.com/a/b.git'), expectSsh)
t.equal(cr('git+ssh://git@github.com/a/b.git'), expectSsh)
t.equal(cr('git+https://user:pass@github.com/a/b.git'), expectAuth)

const hash = '#0000000000000000000000000000000000000000'
t.equal(cr('a/b' + hash), expect + hash)
t.equal(cr('github:a/b' + hash), expect + hash)
t.equal(cr('git+https://github.com/a/b' + hash), expect + hash)
t.equal(cr('git://github.com/a/b' + hash), expect + hash)
t.equal(cr('git+ssh://git@github.com/a/b' + hash), expect + hash)
t.equal(cr('git+https://github.com/a/b.git' + hash), expect + hash)
t.equal(cr('git://github.com/a/b.git' + hash), expect + hash)
t.equal(cr('git+ssh://git@github.com/a/b.git' + hash), expect + hash)
t.equal(cr('xyz@a/b' + hash), expect + hash)
t.equal(cr('xyz@github:a/b' + hash), expect + hash)
t.equal(cr('xyz@git+https://github.com/a/b' + hash), expect + hash)
t.equal(cr('xyz@git://github.com/a/b' + hash), expect + hash)
t.equal(cr('xyz@git+ssh://git@github.com/a/b' + hash), expect + hash)
t.equal(cr('xyz@git+https://github.com/a/b.git' + hash), expect + hash)
t.equal(cr('xyz@git://github.com/a/b.git' + hash), expect + hash)
t.equal(cr('xyz@git+ssh://git@github.com/a/b.git' + hash), expect + hash)
t.equal(cr('a/b' + hash), expectSsh + hash)
t.equal(cr('github:a/b' + hash), expectSsh + hash)
t.equal(cr('git+https://github.com/a/b' + hash), expectHttps + hash)
t.equal(cr('git://github.com/a/b' + hash), expectSsh + hash)
t.equal(cr('git+ssh://git@github.com/a/b' + hash), expectSsh + hash)
t.equal(cr('git+https://github.com/a/b.git' + hash), expectHttps + hash)
t.equal(cr('git://github.com/a/b.git' + hash), expectSsh + hash)
t.equal(cr('git+ssh://git@github.com/a/b.git' + hash), expectSsh + hash)
t.equal(cr('xyz@a/b' + hash), expectSsh + hash)
t.equal(cr('xyz@github:a/b' + hash), expectSsh + hash)
t.equal(cr('xyz@git+https://github.com/a/b' + hash), expectHttps + hash)
t.equal(cr('xyz@git://github.com/a/b' + hash), expectSsh + hash)
t.equal(cr('xyz@git+ssh://git@github.com/a/b' + hash), expectSsh + hash)
t.equal(cr('xyz@git+https://github.com/a/b.git' + hash), expectHttps + hash)
t.equal(cr('xyz@git://github.com/a/b.git' + hash), expectSsh + hash)
t.equal(cr('xyz@git+ssh://git@github.com/a/b.git' + hash), expectSsh + hash)
t.end()
})

Expand Down