Skip to main content

Module branch_pattern

Module branch_pattern 

Source
Expand description

pre-push-branch-pattern — reject branch names that don’t follow the convention, unless the branch is already on the remote.

Ported from zsh. The shell version needed rg with a grep fallback and a pattern written to satisfy both engines; here the match is a dozen lines of ASCII checks, so the rg/grep split and HOOKS_FORCE_GREP disappear entirely — as does the failure mode that motivated them, where a missing rg made ! rg … true and the hook rejected EVERY branch name.

Functions§

conforms
Both the rule and the message now come from vocabulary, so what a user is told and what is enforced cannot drift — and neither can the branch prefixes and the commit types, which had diverged to the point that docs/… was unpushable while docs: was a valid commit type.
early
The same contract, said at the FIRST COMMIT — pre-commit-branch-pattern.
run
Judged on the REFS BEING PUSHED, not on the branch that happens to be checked out.