Skip to content

Commit bebe4cc

Browse files
Ngo The Trungarcanis
authored andcommitted
Fix GitFetcher.fetchFromLocal using wrong hash (#3527)
Following up #3449 expectHash is used beforehand to generate the cache destination, but actualHash is returned. This causes future cache destination path generation to use the wrong hash, resulting in EOENT errors.
1 parent 168ae00 commit bebe4cc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/fetchers/git-fetcher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ export default class GitFetcher extends BaseFetcher {
104104
.pipe(untarStream)
105105
.on('finish', () => {
106106
const expectHash = this.hash;
107+
invariant(expectHash, 'Commit hash required');
108+
107109
const actualHash = hashStream.getHash();
108110

109111
// This condition is disabled because "expectHash" actually is the commit hash
110112
// This is a design issue that we'll need to fix (https://github.com/yarnpkg/yarn/pull/3449)
111113
if (true || !expectHash || expectHash === actualHash) {
112114
resolve({
113-
hash: actualHash,
115+
hash: expectHash,
114116
});
115117
} else {
116118
reject(new SecurityError(this.reporter.lang('fetchBadHash', expectHash, actualHash)));

0 commit comments

Comments
 (0)