diff options
Diffstat (limited to 'node_modules/pacote/lib/fetchers/git.js')
-rw-r--r-- | node_modules/pacote/lib/fetchers/git.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/node_modules/pacote/lib/fetchers/git.js b/node_modules/pacote/lib/fetchers/git.js index 6887277ce..7787e2ef4 100644 --- a/node_modules/pacote/lib/fetchers/git.js +++ b/node_modules/pacote/lib/fetchers/git.js @@ -50,7 +50,7 @@ Fetcher.impl(fetchGit, { opts = optCheck(opts) let streamError const stream = new PassThrough().on('error', e => { streamError = e }) - const cacheName = manifest._resolved || spec.saveSpec || spec.fetchSpec + const cacheName = manifest._uniqueResolved || manifest._resolved || '' const cacheStream = ( opts.cache && cacache.get.stream( @@ -69,11 +69,9 @@ Fetcher.impl(fetchGit, { manifest._repo, manifest._ref, manifest._rawRef, tmp, opts ).then(HEAD => { if (streamError) { throw streamError } - if (!manifest._resolved) { - manifest._resolved = spec.saveSpec.replace(/#.*/, `#${HEAD}`) - manifest._uniqueResolved = manifest._resolved - } - return packDir(manifest, cacheName, tmp, stream, opts) + manifest._resolved = spec.saveSpec.replace(/(:?#.*)?$/, `#${HEAD}`) + manifest._uniqueResolved = manifest._resolved + return packDir(manifest, manifest._uniqueResolved, tmp, stream, opts) }) }).catch(err => stream.emit('error', err)) } @@ -125,8 +123,8 @@ function plainManifest (repo, spec, opts) { return { _repo: repo, _rawRef: rawRef, - _resolved: rawRef.match(/^[a-f0-9]$/) && resolved, - _uniqueResolved: rawRef.match(/^[a-f0-9]$/) && resolved + _resolved: rawRef.match(/^[a-f0-9]{40}$/) && resolved, + _uniqueResolved: rawRef.match(/^[a-f0-9]{40}$/) && resolved } } }) |