David Pursehouse | ec31ddf | 2013-02-22 15:49:03 +0900 | [diff] [blame] | 1 | Gerrit Code Review - Commit Validation |
| 2 | ====================================== |
| 3 | |
| 4 | Gerrit supports link:dev-plugins.html[plugin-based] validation of |
David Pursehouse | cde597d4 | 2013-05-30 10:16:17 +0900 | [diff] [blame] | 5 | commits. |
David Pursehouse | ec31ddf | 2013-02-22 15:49:03 +0900 | [diff] [blame] | 6 | |
David Pursehouse | 8f9e9f5 | 2013-05-30 10:35:24 +0900 | [diff] [blame] | 7 | [[new-commit-validation]] |
| 8 | New commit validation |
| 9 | --------------------- |
| 10 | |
| 11 | |
David Pursehouse | cde597d4 | 2013-05-30 10:16:17 +0900 | [diff] [blame] | 12 | Plugins implementing the `CommitValidationListener` interface can |
| 13 | perform additional validation checks against new commits. |
David Pursehouse | ec31ddf | 2013-02-22 15:49:03 +0900 | [diff] [blame] | 14 | |
David Pursehouse | cde597d4 | 2013-05-30 10:16:17 +0900 | [diff] [blame] | 15 | If the commit fails the validation, the plugin can either provide a |
| 16 | message that will be sent back to the git client, or throw an exception |
| 17 | which will cause the commit to be rejected. |
| 18 | |
| 19 | Validation applies to both commits uploaded via `git push`, and new |
| 20 | commits generated via Gerrit's Web UI features such as the rebase, revert |
| 21 | and cherry-pick buttons. |
David Pursehouse | ec31ddf | 2013-02-22 15:49:03 +0900 | [diff] [blame] | 22 | |
David Pursehouse | 9437b7b | 2012-11-05 23:48:58 +0900 | [diff] [blame] | 23 | Out of the box, Gerrit includes a plugin that checks the length of the |
| 24 | subject and body lines of commit messages on uploaded commits. |
| 25 | |
David Pursehouse | 8f9e9f5 | 2013-05-30 10:35:24 +0900 | [diff] [blame] | 26 | [[pre-merge-validation]] |
| 27 | Pre-merge validation |
| 28 | -------------------- |
| 29 | |
| 30 | |
| 31 | Plugins implementing the `MergeValidationListener` interface can |
| 32 | perform additional validation checks against commits before they |
| 33 | are merged to the git repository. |
| 34 | |
| 35 | If the commit fails the validation, the plugin can throw an exception |
| 36 | which will cause the merge to fail. |
| 37 | |
David Pursehouse | ec31ddf | 2013-02-22 15:49:03 +0900 | [diff] [blame] | 38 | |
| 39 | GERRIT |
| 40 | ------ |
| 41 | Part of link:index.html[Gerrit Code Review] |
| 42 | |