Revert "fix(nx): git-hasher should fetch files from git submodules (#11334)"

This reverts commit 65e5e148dbdcbbb0dbb3c111e01cef50a2e58583.
This commit is contained in:
Victor Savkin 2022-10-04 09:52:38 -04:00
parent d227f00bd1
commit f016c81d94

View File

@ -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<{