MCPcopy Create free account
hub / github.com/SethGammon/Citadel / changedFilesFromGit

Function changedFilesFromGit

core/verification/profiles.js:61–75  ·  view source on GitHub ↗
(projectRoot)

Source from the content-addressed store, hash-verified

59}
60
61function changedFilesFromGit(projectRoot) {
62 const dirty = [
63 ...splitLines(runGit(projectRoot, ['diff', '--name-only'])),
64 ...splitLines(runGit(projectRoot, ['diff', '--name-only', '--cached'])),
65 ...splitLines(runGit(projectRoot, ['status', '--short']))
66 .filter((line) => line.startsWith('?? '))
67 .flatMap((line) => listUntrackedPath(projectRoot, line.slice(3).trim())),
68 ];
69 if (dirty.length > 0) return unique(dirty.map(normalizePath));
70
71 const headRange = splitLines(runGit(projectRoot, ['diff', '--name-only', 'HEAD~1', 'HEAD']));
72 if (headRange.length > 0) return unique(headRange.map(normalizePath));
73
74 return splitLines(runGit(projectRoot, ['ls-files'])).map(normalizePath);
75}
76
77function defaultCommand(scripts) {
78 if (scripts.test) return 'npm run test';

Callers 2

Calls 4

splitLinesFunction · 0.85
listUntrackedPathFunction · 0.85
runGitFunction · 0.70
uniqueFunction · 0.70

Tested by

no test coverage detected