fix: parse git rename entries correctly in git-context

This commit is contained in:
Mark IJbema
2026-02-16 18:27:32 +01:00
parent e90630621d
commit c071a6c77a
@@ -141,7 +141,14 @@ function parseNameStatus(output: string): Array<{ status: string; path: string }
if (!output) return []
return output.split("\n").map((line) => {
const [status, ...rest] = line.split("\t")
return { status: status!, path: rest.join("\t") }
let path: string
if (status!.startsWith("R")) {
// Rename: rest = ["old.ts", "new.ts"], use the new path
path = rest[1] ?? rest[0]
} else {
path = rest.join("\t")
}
return { status: status!, path }
})
}