Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(git): fix filling-out of git manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Apr 13, 2017
1 parent 083ac79 commit 95e807c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/finalize-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
}
Expand Down
4 changes: 2 additions & 2 deletions lib/handlers/git/tarball.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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) => {
Expand Down
6 changes: 3 additions & 3 deletions lib/util/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 95e807c

Please sign in to comment.