diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-03-20 03:18:04 +0300 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2015-03-20 03:18:04 +0300 |
commit | 89ce829a00b526d0518f5cd855c323bffe182af0 (patch) | |
tree | 50b4ed1ad38f5fe8712d084a3b9359a4e9a8cd06 /lib | |
parent | 63313eb0c37891c355546fd1093010c8a0c3cd81 (diff) |
hosted-git-info@1.5.3
Use `hosted-git-info` directly to ensure that all GitHub URLs are being
run through the same cloning strategy for caching. Fixes #7630.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cache/maybe-github.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/cache/maybe-github.js b/lib/cache/maybe-github.js index e24099115..44d903106 100644 --- a/lib/cache/maybe-github.js +++ b/lib/cache/maybe-github.js @@ -1,27 +1,28 @@ var assert = require("assert") , log = require("npmlog") , addRemoteGit = require("./add-remote-git.js") + , hosted = require("hosted-git-info") module.exports = function maybeGithub (p, cb) { assert(typeof p === "string", "must pass package name") assert(typeof cb === "function", "must pass callback") - var u = "git://github.com/" + p - log.info("maybeGithub", "Attempting %s from %s", p, u) + var parsed = hosted.fromUrl(p) + log.info("maybeGithub", "Attempting %s from %s", p, parsed.git()) - return addRemoteGit(u, true, function (er, data) { + return addRemoteGit(parsed.git(), true, function (er, data) { if (er) { - var upriv = "ssh://git@github.com:" + p - log.info("maybeGithub", "Attempting %s from %s", p, upriv) + log.info("maybeGithub", "Couldn't clone %s", parsed.git()) + log.info("maybeGithub", "Now attempting %s from %s", p, parsed.ssh()) - return addRemoteGit(upriv, false, function (er, data) { + return addRemoteGit(parsed.ssh(), false, function (er, data) { if (er) return cb(er) - success(upriv, data) + success(parsed.ssh(), data) }) } - success(u, data) + success(parsed.git(), data) }) function success (u, data) { |