diff --git a/lib/finalize-manifest.js b/lib/finalize-manifest.js index 37f0882..ac7da95 100644 --- a/lib/finalize-manifest.js +++ b/lib/finalize-manifest.js @@ -178,7 +178,9 @@ function tarballedProps (pkg, spec, opts) { } return Object.assign(extraProps, { _shrinkwrap: sr, - _resolved: mani && !mani._resolved && spec.spec, + _resolved: (mani && mani._resolved) || + (pkg && pkg._resolved) || + spec.spec, _integrity: hash && hash.toString() }) } diff --git a/lib/handlers/git/tarball.js b/lib/handlers/git/tarball.js index 5c0cc0d..27e9236 100644 --- a/lib/handlers/git/tarball.js +++ b/lib/handlers/git/tarball.js @@ -61,7 +61,7 @@ function fromManifest (manifest, spec, opts) { function withTmp (opts, cb) { if (opts.cache) { // cacache has a special facility for working in a tmp dir - return cache.tmp.withTmp(opts.cache, opts, cb) + return cache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone'}, cb) } else { const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp') const tmpName = uniqueFilename(tmpDir, 'git-clone') @@ -85,7 +85,7 @@ function packDir (manifest, label, tmp, target, opts) { ? opts.dirPacker(manifest, tmp) : tar.pack(tmp, { map: header => { - header.name = 'package/' + header.name + header.name = header.name.replace(tmp, 'package') header.mtime = 0 // make tarballs idempotent }, ignore: (name) => { diff --git a/lib/util/git.js b/lib/util/git.js index aa7f0c2..8fdfc71 100644 --- a/lib/util/git.js +++ b/lib/util/git.js @@ -66,7 +66,7 @@ function fullClone (repo, committish, target, opts) { return execGit(['checkout', committish], { cwd: target }) - }).then(() => headSha(repo, opts)) + }).then(() => headSha(target, opts)) } module.exports.shallow = shallowClone @@ -84,8 +84,8 @@ function shallowClone (repo, branch, target, opts) { target ] return execGit(gitArgs, { - cwd: path.dirname(target) - }, opts).then(() => headSha(repo, opts)) + cwd: target + }, opts).then(() => headSha(target, opts)) } function headSha (repo, opts) {