Expand description
macOS HFS+/APFS Unicode path precomposition (core.precomposeunicode).
On Apple filesystems, directory entries are typically stored in NFD while
Git wants NFC path names in the index and trees. When
core.precomposeunicode is true, Git:
- Converts NFD command-line paths to NFC (
precompose_string_if_needed) - Converts NFD names from
readdirto NFC (precompose_utf8_readdir)
This module mirrors that behavior for Sley. Conversion is gated by a
process-wide flag set from the effective repository config (same role as
git’s precomposed_unicode cache). The flag is shared across threads so
parallel worktree/status workers see the same value as the main thread.
Functions§
- activate_
precompose_ unicode - Activate precomposition from a config bool (or
None→ disabled). - has_
non_ ascii - True if
scontains any non-ASCII byte (git’shas_non_asciipath check). - has_
non_ ascii_ bytes - True if
bytescontains any non-ASCII byte. - precompose_
argv_ if_ needed - Precompose every string in
argsin place (git’sprecompose_argv_prefix). - precompose_
bytes_ if_ needed - Convert UTF-8 bytes from NFD to NFC when precomposition is active.
- precompose_
os_ str_ bytes_ if_ needed - Precompose an
OsStrcomponent for directory entries / git paths. - precompose_
owned_ string_ if_ needed - Precompose an owned
Stringin place when needed. - precompose_
path_ if_ needed - Precompose each component of a path when needed (for index / pathspec paths).
- precompose_
string_ if_ needed - Convert a UTF-8 string from NFD to NFC when precomposition is active.
- precompose_
unicode_ enabled - Whether path precomposition is currently active.
- set_
precompose_ unicode - Enable or disable NFD→NFC path conversion for this process.