published · 2 min read

git ls-files Puts Serbian File Names in Quotes

By default, git prints a name with ć in it as octal escapes inside literal quotes, so a script that splits on newlines and looks names up misses it.

bench/ćevapi.ts and, below it, what git ls-files prints: "bench/\304\207evapi.ts", quote marks included.
What git ls-files prints for one Serbian letter.

An AI agent drafted this from my projects, agents ran the measurements, and another agent checked the draft claim by claim against the code and the run records or briefs that were kept. The projects and opinions are mine.

Ask git to list bench/ćevapi.ts and it prints "bench/\304\207evapi.ts", and those quote marks are part of the output. Here are three versions of this listing on git 2.52.0 on macOS, with no global git config:

git init -q; mkdir bench; echo 1 > "bench/ćevapi.ts"; echo 2 > bench/plain.ts
git ls-files --others --exclude-standard
git ls-files -z --others --exclude-standard | tr '\0' '\n'
git -c core.quotePath=false ls-files --others --exclude-standard
bench/plain.ts
"bench/\304\207evapi.ts"
bench/plain.ts
bench/ćevapi.ts
bench/plain.ts
bench/ćevapi.ts

An agent going through my repos ran those three listings. Git quotes those names by design. Commands that print paths quote "unusual" characters, and core.quotePath, true by default, counts high bytes as unusual: "bytes with values larger than 0x80 (e.g. octal \302\265 for "micro" in UTF-8)". In UTF-8, ć as one character (U+0107) is two such bytes.

The letter ć splits into its two UTF-8 bytes, c4 87, which git writes in octal as \304\207 inside quote marks; with -z or core.quotePath=false the name prints as bench/ćevapi.ts.
Why one letter becomes eight characters and two quote marks.

A program that splits this output on newlines gets a string with quotes in it, and a lookup by real name fails. climb, my measuring plugin for coding agents, freezes the scripts that score an agent's work, and it learns which files those are from git ls-files. Commit 711255c fixed part of this, where files were "linked under their quoted git names (ls-files without -z)". Those calls use -z now and split on NUL. As of 7 November 2026 five others still don't, at src/index.ts:740, 1548, 1643, 1647, 1804, and two git diff --name-only calls, at lines 675 and 1824, quote names the same way. Those five aren't equal: line 740 only prints names in an error, and the proof path at 1804 also finds scripts by name through scriptPaths. Line 1643 builds a Set of tracked files, and instrumentFiles looks up a script with tracked.has. On the --others listing from that toy repo, which has the same quoted names as git ls-files after a git add, the agent got this:

Set has bench/ćevapi.ts: false | Set has bench/plain.ts: true
"bun bench/plain.ts" frozen today: ["bench/plain.ts"] | with -z: ["bench/plain.ts"]
"bun bench/ćevapi.ts" frozen today: [] | with -z: ["bench/ćevapi.ts"]

With a name like that, a scorer doesn't get frozen. From reading line 1548, the check that refuses an uncommitted scorer has this gap too. The agent ran the function alone, without a full climb session. I don't know how it plays out over a whole goal. git status --porcelain at line 323 quotes names too, and from reading lines 323-336, restore(), which puts back tracked files a measuring run rewrote, passes them to git checkout --. One quoted name makes git reject the whole command, so none of the files is put back.

core.quotePath=false handles non-ASCII names too, though there is a limit: a tab, newline, backslash or double quote still comes out quoted. The docs call those "always escaped regardless of the setting of this variable." That leaves -z with a split on \0 as the better fix.

For ls-files and diff --name-only it's one record per entry; where a command prints renames, -z changes the record layout, so the parser has to change with it. And -z fixes the quoting, not normalization: a name stored decomposed (c plus a combining accent) comes back decomposed, so normalize both sides to the composed form (NFC) before comparing, but hand git back the bytes it printed.