Fix invalid ref name being accepted by Gerrit

When editing a project configuration by using the UI or by submitting a
change to refs/meta/config, it was possible to add a permission to an
invalid reference pattern. This caused the project to be unavailable and
the ls-projects command to abort whenever this project was encountered.

Validate reference patterns, reject invalid ones and show error message
accordingly. Reference patterns using the ${username} placeholder are
supported.

Bug: Issue 3557
Change-Id: I8d0ca3872f4243002d69fbadeb65ce42f038fc33
3 files changed