[PR #9844] fix: Windows snapshot fails with non-ASCII filenames (Chinese, Japanese, etc.) #13242

Open
opened 2026-02-16 18:18:06 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9844

State: open
Merged: No


Summary

Fix undo/revert not working on Windows when project contains non-ASCII filenames (e.g., Chinese, Japanese, Korean characters).

Problem

On Windows, Bun's $ template literal incorrectly handles variable interpolation, replacing variables with placeholders like ?__bunstr_0 instead of actual values. This causes:

  1. git add . to silently fail adding non-ASCII filenames to snapshot
  2. git checkout / git ls-tree to fail finding files during revert
  3. Undo command only reverts conversation but not code changes

Solution

Replace all $ template calls with Bun.spawn() which correctly passes arguments as an array, bypassing shell interpolation issues.

Also adds unquote() function to decode git octal-escaped non-ASCII filenames in diff output (when core.quotepath=true, which is the default).

Testing

Tested on Windows 11 with Chinese filenames (e.g., 公共函数.cpp) - undo now correctly reverts files.

Fixes #10210

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9844 **State:** open **Merged:** No --- ## Summary Fix undo/revert not working on Windows when project contains non-ASCII filenames (e.g., Chinese, Japanese, Korean characters). ## Problem On Windows, Bun's `$` template literal incorrectly handles variable interpolation, replacing variables with placeholders like `?__bunstr_0` instead of actual values. This causes: 1. `git add .` to silently fail adding non-ASCII filenames to snapshot 2. `git checkout` / `git ls-tree` to fail finding files during revert 3. Undo command only reverts conversation but not code changes ## Solution Replace all `$` template calls with `Bun.spawn()` which correctly passes arguments as an array, bypassing shell interpolation issues. Also adds `unquote()` function to decode git octal-escaped non-ASCII filenames in diff output (when `core.quotepath=true`, which is the default). ## Testing Tested on Windows 11 with Chinese filenames (e.g., `公共函数.cpp`) - undo now correctly reverts files. Fixes #10210
yindo added the pull-request label 2026-02-16 18:18:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13242