Girocco/ValidUtil.pm: refactor valid branch name check
The branch name checking regular expression has become more-or-less
unreadable:
/^\/|^\.|[\x00-\x1f \x7f\[\[~^"'"<>*?\\:]|\@\{|\.\.|\.lock$|\.$|\/$/
And is duplicated in three different places while not managing to catch
all the restrictions enforced by Git (see `git help check-ref-format`).
The fact that if you look closely at it you can even see it checking
for the same disallowed character twice (the '[') character.
This suggests it has become somewhat unmaintainable in its current form.
One challenge is that it's used by the install-time-only
Girocco::Validator module and at runtime by the Girocco::Project module.
Its use by the Girocco::Validator module makes it particularly
tricky to refactor since the Girocco::Validator module validates
the Girocco::Config module which pretty much all the other
currently existing Girocco modules "use". Therefore moving the
validation expression into Girocco::Util will simply not work
(because then Girocco::Validator would need to "use" that module
which in turn "use"s Girocco::Config which Girocco::Validator is
trying to validate -- a bad idea).
Create a new Girocco::ValidUtil module that does not "use" any other
modules but exports a suitable `valid_branch_name` function for use
by other modules.
Take this opportunity to explicitly list all the rules it enforces,
fix the items it was failing to catch and make the regex much more
readable and understandable by using the "/x" modifier.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>