MCPcopy
hub / github.com/di-sukharev/opencommit / getStagedFiles

Function getStagedFiles

src/utils/git.ts:43–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41};
42
43export const getStagedFiles = async (): Promise<string[]> => {
44 const gitDir = await getGitDir();
45
46 const { stdout: files } = await execa(
47 'git',
48 ['diff', '--name-only', '--cached', '--relative'],
49 { cwd: gitDir }
50 );
51
52 if (!files) return [];
53
54 const filesList = files.split('\n');
55
56 const ig = await getOpenCommitIgnore();
57 const allowedFiles = filesList.filter((file) => !ig.ignores(file));
58
59 if (!allowedFiles) return [];
60
61 return allowedFiles.sort();
62};
63
64export const getChangedFiles = async (): Promise<string[]> => {
65 const gitDir = await getGitDir();

Callers 2

prepareCommitMessageHookFunction · 0.90
commitFunction · 0.90

Calls 6

execaFunction · 0.85
filterMethod · 0.80
ignoresMethod · 0.80
getGitDirFunction · 0.70
getOpenCommitIgnoreFunction · 0.70
sortMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…