diff options
Diffstat (limited to 'deps/npm/node_modules/pacote/lib/util/git.js')
-rw-r--r-- | deps/npm/node_modules/pacote/lib/util/git.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/deps/npm/node_modules/pacote/lib/util/git.js b/deps/npm/node_modules/pacote/lib/util/git.js index a24edccdd0..a6162ceeba 100644 --- a/deps/npm/node_modules/pacote/lib/util/git.js +++ b/deps/npm/node_modules/pacote/lib/util/git.js @@ -58,7 +58,7 @@ function fullClone (repo, committish, target, opts) { return execGit(gitArgs, { cwd: path.dirname(target) }, opts).then(() => { - return execGit(['checkout', committish], { + return committish && execGit(['checkout', committish], { cwd: target }) }).then(() => { @@ -69,7 +69,11 @@ function fullClone (repo, committish, target, opts) { module.exports.shallow = shallowClone function shallowClone (repo, branch, target, opts) { opts = optCheck(opts) - const gitArgs = ['clone', '--depth=1', '-q', '-b', branch, repo, target] + const gitArgs = ['clone', '--depth=1', '-q'] + if (branch) { + gitArgs.push('-b', branch) + } + gitArgs.push(repo, target) if (process.platform === 'win32') { gitArgs.push('--config', 'core.longpaths=true') } @@ -204,8 +208,8 @@ function checkGit () { } } -const REFS_TAGS = '/refs/tags/' -const REFS_HEADS = '/refs/heads/' +const REFS_TAGS = 'refs/tags/' +const REFS_HEADS = 'refs/heads/' const HEAD = 'HEAD' function refType (ref) { return ref.indexOf(REFS_TAGS) !== -1 |