Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 89ce829

Browse files
committed
Use `hosted-git-info` directly to ensure that all GitHub URLs are being run through the same cloning strategy for caching. Fixes #7630.
1 parent 63313eb commit 89ce829

34 files changed

+13
-1370
lines changed

lib/cache/maybe-github.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
var assert = require("assert")
22
, log = require("npmlog")
33
, addRemoteGit = require("./add-remote-git.js")
4+
, hosted = require("hosted-git-info")
45

56
module.exports = function maybeGithub (p, cb) {
67
assert(typeof p === "string", "must pass package name")
78
assert(typeof cb === "function", "must pass callback")
89

9-
var u = "git://github.com/" + p
10-
log.info("maybeGithub", "Attempting %s from %s", p, u)
10+
var parsed = hosted.fromUrl(p)
11+
log.info("maybeGithub", "Attempting %s from %s", p, parsed.git())
1112

12-
return addRemoteGit(u, true, function (er, data) {
13+
return addRemoteGit(parsed.git(), true, function (er, data) {
1314
if (er) {
14-
var upriv = "ssh://[email protected]:" + p
15-
log.info("maybeGithub", "Attempting %s from %s", p, upriv)
15+
log.info("maybeGithub", "Couldn't clone %s", parsed.git())
16+
log.info("maybeGithub", "Now attempting %s from %s", p, parsed.ssh())
1617

17-
return addRemoteGit(upriv, false, function (er, data) {
18+
return addRemoteGit(parsed.ssh(), false, function (er, data) {
1819
if (er) return cb(er)
1920

20-
success(upriv, data)
21+
success(parsed.ssh(), data)
2122
})
2223
}
2324

24-
success(u, data)
25+
success(parsed.git(), data)
2526
})
2627

2728
function success (u, data) {

node_modules/npm-package-arg/node_modules/hosted-git-info/package.json node_modules/hosted-git-info/package.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/npm-registry-client/node_modules/npm-package-arg/LICENSE

-15
This file was deleted.

node_modules/npm-registry-client/node_modules/npm-package-arg/README.md

-101
This file was deleted.

node_modules/npm-registry-client/node_modules/npm-package-arg/node_modules/hosted-git-info/.npmignore

-3
This file was deleted.

node_modules/npm-registry-client/node_modules/npm-package-arg/node_modules/hosted-git-info/.travis.yml

-5
This file was deleted.

node_modules/npm-registry-client/node_modules/npm-package-arg/node_modules/hosted-git-info/README.md

-82
This file was deleted.

0 commit comments

Comments
 (0)