From f016c81d94dfd806bed5df5a04fe7732fdeca994 Mon Sep 17 00:00:00 2001 From: Victor Savkin Date: Tue, 4 Oct 2022 09:52:38 -0400 Subject: [PATCH] Revert "fix(nx): git-hasher should fetch files from git submodules (#11334)" This reverts commit 65e5e148dbdcbbb0dbb3c111e01cef50a2e58583. --- packages/nx/src/hasher/git-hasher.ts | 41 ++-------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/packages/nx/src/hasher/git-hasher.ts b/packages/nx/src/hasher/git-hasher.ts index 4b0ccdddc0..e93ce44f15 100644 --- a/packages/nx/src/hasher/git-hasher.ts +++ b/packages/nx/src/hasher/git-hasher.ts @@ -105,13 +105,7 @@ async function spawnProcess( async function getStagedFiles(path: string) { const { stdout: staged } = await spawnProcess( 'git', - [ - 'ls-files', - /*'--recurse-submodules',*/ '-s', - '-z', - '--exclude-standard', - '.', - ], + ['ls-files', '-s', '-z', '--exclude-standard', '.'], path ); const res = new Map(); @@ -127,52 +121,23 @@ async function getStagedFiles(path: string) { } async function getUnstagedFiles(path: string) { - //this command will list all parent repo's modefied files const { stdout: unstaged } = await spawnProcess( 'git', ['ls-files', '-m', '-z', '--exclude-standard', '.'], path ); - //and this command will only list nested submodules modefied files - const { stdout: unstagedInSubModules } = await spawnProcess( - 'git', - [ - 'submodule', - 'foreach', - '--recursive', - '--quiet', - 'git ls-files -m -z --exclude-standard .', - ], - path - ); const lines = unstaged.split('\0').filter((f) => !!f); - const additionalLines = unstagedInSubModules.split('\0').filter((f) => !!f); - return getGitHashForFiles([...lines, ...additionalLines], path); + return getGitHashForFiles(lines, path); } async function getUntrackedFiles(path: string) { - //this command will list all parent repo's untracked files const { stdout: untracked } = await spawnProcess( 'git', ['ls-files', '--other', '-z', '--exclude-standard', '.'], path ); - //and this command will only list nested submodules untracked files - const { stdout: untrackedInSubModules } = await spawnProcess( - 'git', - [ - 'submodule', - 'foreach', - '--recursive', - '--quiet', - 'git ls-files --other -z --exclude-standard .', - ], - path - ); const lines = untracked.split('\0').filter((f) => !!f); - const additionalLines = untrackedInSubModules.split('\0').filter((f) => !!f); - - return getGitHashForFiles([...lines, ...additionalLines], path); + return getGitHashForFiles(lines, path); } export async function getFileHashes(path: string): Promise<{