Skip to main content

GIT_REF_NAME_MAX_LEN

Constant GIT_REF_NAME_MAX_LEN 

Source
pub const GIT_REF_NAME_MAX_LEN: usize = 255;
Expand description

Max length, in bytes, of a single typed git ref name passing the is_git_ref_name predicate. 255 bytes — matches the POSIX NAME_MAX filesystem-component limit every Git porcelain ultimately stores refs into (loose refs/<category>/<name> files under .git/refs/, packed-refs index entries). Refs that exceed this cap fail to land on disk at clone/fetch time on every realistic filesystem (ext4, btrfs, xfs, APFS, NTFS), so a :tag / :branch past that length is unsourceable in practice. The cap exists to reject the paste-from-binary footgun (a multi-line blob accidentally landed in the :tag slot) rather than to constrain legitimate authoring — realistic tag/branch names rarely exceed ~32 bytes ("v0.1.0" = 6 bytes, "release-1.0-alpha.1" = 19 bytes, "feature/checkout-rewrite" = 24 bytes). Lifted as a typed const so a future axis reaching for the same bound (the future lacre.lisp ref-shape gate on resolved-pin axes, the future M4 per-dep CR materializer’s per-pin validator) reads from one place.