MCPcopy
hub / github.com/openclaw/clawsweeper / gitChangedFiles

Function gitChangedFiles

src/repair/git-repo-utils.ts:259–272  ·  view source on GitHub ↗
(targetDir: string, baseBranch: string)

Source from the content-addressed store, hash-verified

257}
258
259export function gitChangedFiles(targetDir: string, baseBranch: string): string[] {
260 const baseRef = `origin/${baseBranch}`;
261 const committed = run("git", ["diff", "--name-only", `${baseRef}...HEAD`], { cwd: targetDir })
262 .split("\n")
263 .map((line) => line.trim())
264 .filter(Boolean);
265 const uncommitted = run("git", ["status", "--porcelain"], { cwd: targetDir })
266 .split("\n")
267 .map((line) => line.trim())
268 .map((line) => line.replace(/^.. /, ""))
269 .map((line) => line.split(" -> ").pop())
270 .filter(Boolean);
271 return uniqueStrings([...committed, ...uncommitted]);
272}
273
274export function gitLsFiles(targetDir: string): string[] {
275 return run("git", ["ls-files"], { cwd: targetDir })

Callers 1

changedTestFilesFunction · 0.85

Calls 2

uniqueStringsFunction · 0.70
runFunction · 0.50

Tested by

no test coverage detected