Skip to main content

non_utf8_filename

Function non_utf8_filename 

Source
pub fn non_utf8_filename() -> OsString
Available on Unix only.
Expand description

A file-name whose bytes are not valid UTF-8 — for exercising lossless path handling on Unix, where a filename may be an arbitrary byte sequence (only / and NUL are forbidden). The returned OsString can be joined onto a directory (Path::join) and written with std::fs::write; the toolkit’s status/diff/conflict paths must carry these exact bytes back (not a U+FFFD-substituted String) for a status → add/commit_paths round trip.

Unix only. A Windows filename is UTF-16 (an unpaired surrogate, not a raw invalid-UTF-8 byte, is its analogue), so git/jj never emit raw invalid-UTF-8 path bytes there; gate any test that uses this on #[cfg(unix)].