pub fn validate_ref_name(name: &str) -> boolExpand description
Validate a ref name per SPEC-REFS §3. Used at every transport boundary; transports MUST NOT silently lower-case or canonicalise.
Grammar:
- Non-empty.
- Segments split on
/, each segment matches[A-Za-z0-9._-]+. - No segment may start with
.(this also rejects the exact.and..segments) — git’scheck-ref-formatrule, kept for parity: a dot-leading component is invalid in both grammars, so nothing on-disk under a dot-leading directory (e.g. crash debris from a temp-directory rename, or an in-flightatomic::write_atomictemp file) can ever surface as a ref incollect_refs/ listings. No empty segments (no//, no leading/, no trailing/). - No
\\or NUL bytes. - No segment may end in
.lock(the canonical lock-file suffix). - The final segment may not be the literal
HEAD, since that would shadow the repo-levelHEADpointer.