Expand description
Ref-name validation — git check-ref-format rules.
This module implements the same validation logic as
git check_refname_format() in git/refs.c, including the
--allow-onelevel, --refspec-pattern, and --normalize options.
§Rules
A ref name is valid when:
- No path component begins with
. - No
..anywhere - No ASCII control characters (< 0x20 or DEL 0x7f)
- No space,
~,^,:,?,[,\ - No trailing
/ - No path component ends with
.lock - No
@{ - Cannot be exactly
@ - No consecutive slashes
//(unless--normalizecollapses them) - No leading
/(unless--normalizestrips it) - No trailing
. - Must have at least two slash-separated components (unless
--allow-onelevel)
Structs§
- RefName
Options - Options controlling validation.
Enums§
- RefName
Error - Errors returned by
check_refname_format.
Functions§
- check_
refname_ format - Validate
refnameaccording to Git ref-name rules. - collapse_
slashes - Strip a leading
/and collapse consecutive interior slashes to one.