Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): hide leaky error message from git show command in affected #12521

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/nx/src/project-graph/file-utils.ts
Expand Up @@ -89,9 +89,9 @@ export function calculateFileChanges(
}
switch (ext) {
case '.json':
const atBase = readFileAtRevision(f, nxArgs.base);
const atHead = readFileAtRevision(f, nxArgs.head);
try {
const atBase = readFileAtRevision(f, nxArgs.base);
const atHead = readFileAtRevision(f, nxArgs.head);
return jsonDiff(JSON.parse(atBase), JSON.parse(atHead));
} catch (e) {
return [new WholeFileChange()];
Expand Down Expand Up @@ -122,6 +122,7 @@ function defaultReadFileAtRevision(
? readFileSync(file, 'utf-8')
: execSync(`git show ${revision}:${filePathInGitRepository}`, {
maxBuffer: TEN_MEGABYTES,
stdio: ['pipe', 'pipe', 'ignore'],
})
.toString()
.trim();
Expand Down