Skip to content

Commit 1e80ec6

Browse files
committed
fix(demo/ctx): extract new path from rename entries in git status --porcelain
Made-with: Cursor
1 parent ab12215 commit 1e80ec6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

demo/ctx/src/files.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ export function getChangedFiles(cwd: string, commits: number | null): string[] {
4444
output = git(`git diff HEAD~${commits} --name-only`, cwd);
4545
} else {
4646
output = git("git status --porcelain", cwd)
47-
.split("\n").filter(Boolean).map((l) => l.slice(3).trim()).join("\n");
47+
.split("\n").filter(Boolean).map((l) => {
48+
const entry = l.slice(3).trim();
49+
return entry.includes(" -> ") ? entry.split(" -> ")[1].trim() : entry;
50+
}).join("\n");
4851
}
4952
const paths = output.split("\n").map((f) => f.trim()).filter(Boolean)
5053
.map((f) => path.join(cwd, f));

0 commit comments

Comments
 (0)