fix(server): render non-ASCII filenames in git output

Fixes #436
This commit is contained in:
Samatar
2026-05-19 01:16:33 +00:00
committed by GitHub
parent 9bc6210823
commit 5a1c7f266c
2 changed files with 8 additions and 2 deletions
@@ -16,8 +16,12 @@ vi.mock("child_process", async () => {
const [command, commandArgs] = args;
if (command === "git" && Array.isArray(commandArgs)) {
const normalizedArgs = commandArgs.map((arg) => String(arg));
// `runGitCommand` always prepends `-c core.quotepath=false`; skip it to
// find the actual git subcommand.
const subcommandIndex =
normalizedArgs[0] === "-c" && normalizedArgs[1] === "core.quotepath=false" ? 2 : 0;
const isTrackedTextDiff =
normalizedArgs[0] === "diff" &&
normalizedArgs[subcommandIndex] === "diff" &&
normalizedArgs.includes("HEAD") &&
!normalizedArgs.includes("--numstat") &&
!normalizedArgs.includes("--no-index") &&