Expand description
Commit encoding helpers for non-UTF-8 commit messages.
Functions§
- decode_
bytes - Decode
bytesusing Git’s encoding name, or lossy UTF-8 if unknown. - encode_
header_ text - Encode a single header field (author/committer line) without adding a trailing newline.
- encode_
unicode - Encode
unicodefor storage in a commit message body using Git’s encoding name. - ensure_
body_ trailing_ newline - Git stores the commit message body with a trailing newline when non-empty.
- finalize_
stored_ commit_ message - Prepare a commit message for storage per
i18n.commitEncoding(or equivalent). - find_
invalid_ utf8 - Find the offset of the first byte that is not part of a strictly valid UTF-8
sequence, mirroring Git’s
find_invalid_utf8(commit.c). - identity_
raw_ for_ serialized_ commit - Raw
author/committerheader payloads for a new commit object. - is_
strict_ utf8 - Whether
bufis strictly valid UTF-8 per Git’s rules (seefind_invalid_utf8). - resolve
- Resolve an encoding label the way Git uses it in config and commit objects.