Gerrit supports plugin-based validation of commits.
New commit validation
Plugins implementing the CommitValidationListener
interface can
perform additional validation checks against new commits.
If the commit fails the validation, the plugin can either provide a message that will be sent back to the git client, or throw an exception which will cause the commit to be rejected.
Validation applies to both commits uploaded via git push
, and new
commits generated via Gerrit’s Web UI features such as the rebase, revert
and cherry-pick buttons.
Out of the box, Gerrit includes a plugin that checks the length of the subject and body lines of commit messages on uploaded commits.
Pre-merge validation
Plugins implementing the MergeValidationListener
interface can
perform additional validation checks against commits before they
are merged to the git repository.
If the commit fails the validation, the plugin can throw an exception which will cause the merge to fail.
Part of Gerrit Code Review