diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cache/add-remote-git.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/cache/add-remote-git.js b/lib/cache/add-remote-git.js index acda6d590..ac8e03ca7 100644 --- a/lib/cache/add-remote-git.js +++ b/lib/cache/add-remote-git.js @@ -53,10 +53,6 @@ module.exports = function addRemoteGit (u, silent, cb) { u = u.replace(/^ssh:\/\//, "") } - cb = inflight(u, cb) - if (!cb) return log.verbose("addRemoteGit", u, "already in flight; waiting") - log.verbose("addRemoteGit", u, "not in flight; cloning") - // figure out what we should check out. var co = parsed.hash && parsed.hash.substr(1) || "master" @@ -66,6 +62,9 @@ module.exports = function addRemoteGit (u, silent, cb) { log.verbose("addRemoteGit", [u, co]) var p = path.join(remotes, v) + cb = inflight(p, cb) + if (!cb) return log.verbose("addRemoteGit", p, "already in flight; waiting") + log.verbose("addRemoteGit", p, "not in flight; cloning") getGitDir(function (er) { if (er) return cb(er) @@ -100,7 +99,7 @@ function getGitDir (cb) { function checkGitDir (p, u, co, origUrl, silent, cb) { fs.stat(p, function (er, s) { if (er) return cloneGitRemote(p, u, co, origUrl, silent, cb) - if (!s.isDirectory()) return rm(p, function (er){ + if (!s.isDirectory()) return rm(p, function (er) { if (er) return cb(er) cloneGitRemote(p, u, co, origUrl, silent, cb) }) |