diff --git a/tap-snapshots/test/lib/commands/ls.js.test.cjs b/tap-snapshots/test/lib/commands/ls.js.test.cjs index fc7fbdf8a906f..00199d485f7df 100644 --- a/tap-snapshots/test/lib/commands/ls.js.test.cjs +++ b/tap-snapshots/test/lib/commands/ls.js.test.cjs @@ -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`] = ` diff --git a/test/lib/commands/ls.js b/test/lib/commands/ls.js index c876af9e83ddf..9a10c97b6032c 100644 --- a/test/lib/commands/ls.js +++ b/test/lib/commands/ls.js @@ -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', }, }, }, diff --git a/workspaces/arborist/lib/arborist/reify.js b/workspaces/arborist/lib/arborist/reify.js index abc2c8a5dd0bd..811d81f269350 100644 --- a/workspaces/arborist/lib/arborist/reify.js +++ b/workspaces/arborist/lib/arborist/reify.js @@ -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) diff --git a/workspaces/arborist/lib/consistent-resolve.js b/workspaces/arborist/lib/consistent-resolve.js index 890caa32f1072..20b119ac9ee52 100644 --- a/workspaces/arborist/lib/consistent-resolve.js +++ b/workspaces/arborist/lib/consistent-resolve.js @@ -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 diff --git a/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs index a4ca3e75702f5..069478e5c0cb9 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs @@ -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 { diff --git a/workspaces/arborist/tap-snapshots/test/arborist/load-virtual.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/load-virtual.js.test.cjs index 25ac9457c8c86..f8a77d30e108a 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/load-virtual.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/load-virtual.js.test.cjs @@ -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 { @@ -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 { @@ -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 { @@ -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", diff --git a/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs b/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs index 9103febb644ee..1925afbbcf38f 100644 --- a/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs @@ -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", @@ -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 { @@ -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", } ` diff --git a/workspaces/arborist/tap-snapshots/test/yarn-lock.js.test.cjs b/workspaces/arborist/tap-snapshots/test/yarn-lock.js.test.cjs index bb26983f49f52..423153dedb53b 100644 --- a/workspaces/arborist/tap-snapshots/test/yarn-lock.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/yarn-lock.js.test.cjs @@ -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" diff --git a/workspaces/arborist/test/consistent-resolve.js b/workspaces/arborist/test/consistent-resolve.js index 3792e886fb04e..5fe77bc9031e7 100644 --- a/workspaces/arborist/test/consistent-resolve.js +++ b/workspaces/arborist/test/consistent-resolve.js @@ -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() })