You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b3d736a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(diff): preserve legacy filename bytes in staged diffs (#2030)
Aider-style staged-file reads fail with `UnicodeDecodeError` when a raw
diff contains a non-UTF-8 filename. Index entries and blob streams already
preserve the legacy bytes, but `Diff._handle_diff_line()` decoded the entire
NUL-delimited output before separating metadata from paths.
Keep raw diff fields as bytes, decode only the ASCII mode/OID/status
metadata, and pass original path bytes into `Diff`. This also preserves
rename and copy destinations without requiring callers to reencode them.
The existing text path properties retain their display behavior.
Git 2.54.0's `Documentation/diff-options.adoc` specifies that `--raw -z`
returns unmodified pathnames separated by NULs.
All six new regressions failed before the fix: five cover raw add/delete/
modify/rename/copy records, and one stages Windows-1252 filename and content
bytes in a real index and reads its diff and blobs. All diff and index tests
now pass with CLI and Gix backends: 150 passed, 2 skipped, and 9 subtests on
each. Ruff and ShellCheck pass. Windows execution remains for CI validation;
no conversion of the legacy files is needed.
0 commit comments