Expand description
Exact repository path bytes as the operating system takes them, and as text for messages.
What:
Exact repository path bytes as the operating system takes them,
and as text for messages.
Why:
Git allows any bytes in a file name.
The commit path keeps a path as Vec<u8> from Git’s listing to Git’s next argument,
so a name that is not UTF-8 reaches Git unchanged;
only a message for a person shows the text with replacement characters.
In TS you’d write (pseudocode):
// const argument = Buffer.from(bytes); const shown = bytes.toString('utf8');Functions§
- os_
from_ path_ bytes - What:
Raw path bytes as an operating-system string for a command line or a file name.
&[u8]borrows the bytes; the result owns a copy. Why: A Git path is bytes, and only the platform decides how to pass them on: Unix takes them as they are, other platforms have text names, so the text with replacement characters is the closest name. - path_
message_ text - What: The readable text of path bytes for a message, with each invalid sequence replaced by U+FFFD. Why: Messages are text, and the exact bytes travel in the field next to them.