Skip to main content

Module name_encoding

Module name_encoding 

Source
Expand description

Reversible UTF-8 names for portable, case-sensitive storage.

Constants§

NAME_PATH_BUDGET
Maximum relative name path in bytes. With a 512-byte repository root, .heddle/threads/ (17), a 255-byte checkout leaf plus separator (256), and 111 bytes for checkout-local Heddle metadata, the absolute path is at most 1024 bytes. Two encoded names in remote refs also fit this budget.

Functions§

decode_name
Strict inverse; reject aliases and malformed/non-UTF-8 encodings.
decode_name_path
Decode only canonical storage paths, including exact UTF-8 identity.
encode_name
Percent escaping shared by ref storage and managed checkouts. Uppercase ASCII is escaped too: distinct names stay distinct on case-folding hosts. The n- prefix excludes Windows device names; dots and hostile bytes escape.
git_name
Undo the reserved import mapping when projecting a native name back to Git.
is_digest_name_path
Recognize the complete digest path; never accept a digest prefix or alias.
name_path
Bounded components and a terminal directory keep even long names disjoint. Each chunk is ASCII, at most 182 bytes; entry can never be another chunk. Long names use the full BLAKE3 digest of the exact native UTF-8 identity. Their entry must carry a name file, verified by the filesystem reader.
native_git_name
Map Git names that collide with native reservation (or the escape prefix) into a distinct native identity. Signed source refs always keep their bytes.
strip_ref_line_ending
Remove only one LF or CRLF framing terminator, preserving name bytes.