claude-hud: decoding every escape git puts in a quoted path

Merged into claude-hud, a Claude Code status plugin. Git C-escapes a path when it holds unusual characters, but the plugin decoded those paths with JSON.parse, which understands only JSON escapes. Control-character and octal escapes came back garbled, so affected filenames rendered wrong in the HUD. I replaced the JSON parse with a C-style decoder that handles every escape git emits, including multi-byte UTF-8 written as consecutive octal sequences.

October 1, 2026

What was wrong

Git quotes a path that contains unusual bytes and escapes it in C style. The plugin ran those quoted paths through JSON.parse, which decodes JSON escapes such as \n and \t but not C escapes such as \a and \v, and not octal. A path carrying one of those came back garbled, and a UTF-8 character written as consecutive octal bytes was never reassembled.

The change

The JSON parse is replaced with a decoder that walks the quoted path and resolves each escape the way git wrote it: the named control escapes, octal sequences, and runs of octal bytes reassembled into their multi-byte UTF-8 character. Paths with those characters now show correctly.

jarrodwatts/claude-hud #765, merged