From cbd82d037f245895dac99b12784c87233cdacfcc Mon Sep 17 00:00:00 2001 From: AgentEnder Date: Tue, 11 Oct 2022 09:59:10 -0400 Subject: [PATCH] fix(core): hide leaky error message from git show command in affected --- packages/nx/src/project-graph/file-utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/project-graph/file-utils.ts b/packages/nx/src/project-graph/file-utils.ts index 2aae12c2ce651..b4f2bc1e00d26 100644 --- a/packages/nx/src/project-graph/file-utils.ts +++ b/packages/nx/src/project-graph/file-utils.ts @@ -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()]; @@ -122,6 +122,7 @@ function defaultReadFileAtRevision( ? readFileSync(file, 'utf-8') : execSync(`git show ${revision}:${filePathInGitRepository}`, { maxBuffer: TEN_MEGABYTES, + stdio: ['pipe', 'pipe', 'ignore'], }) .toString() .trim();