Pre-receive hooks for push rules should provide an error message that a push rule has been violated (Bonus: which rule and how/why)
Release notes
If push rules are defined, a commit breaking the rules, will be declined by the pre-receive hook, but the user does not get an error message that describes which/what rule has been broken or that a push rule is even in place.
Since custom error messages for server hooks can be defined , the basic functionality is already in place and only needs to be utilized for push rules.
Problem to solve
As a user I want to know that (and why) a push has been declined by a pre-receive hook when a push rule is defined, so I can edit my commit to adhere to the push rule.
Intended users
User experience goal
The user should receive an error message that a push rule prevented a commit from being accepted.
- Minimal goal: "pre-receive hook declined: a push rule has been violated"
- Standard goal: "pre-receive hook declined: a push rule has been violated, branch name did not match regular expression."
- Bonus goal: "pre-receive hook declined: a push rule has been violated, branch name did not match regular expression '(feature|hotfix)/*'. "
Proposal
Add error message to a pre-receive hook, when a push-rule is defined/configured, similar to server hooks.
Further details
Further details can be provided on request.
Permissions and Security
Push rules should not be considered to be security sensitive.
Documentation
Adapt push rules documentation.