|
Git Server Hooks |
|
The ensure-review-started and ensure-reviewed hooks ensure that files cannot be committed unless certain conditions are met. If a user attempts to commit files that do not meet those conditions, an error message describing the unfulfilled conditions will be displayed and the files will not be committed. If the conditions are met, the commit will be allowed to continue normally. The ensure-review-started hook requires that the review exist; ensure-reviewed requires that the review be completed. If you are familiar with Gerrit (an open source Git-focused review package), you can implement a similar workflow for your engineering staff using Collaborator and Git triggers. Further information may be found on the SmartBear blog in the "Gerrit-Style Code Review with Collaborator" post. To use the ensure-review-started and ensure-reviewed hooks, you must require developers to put the review ID somewhere in the Git commit message. The format of this text is completely up to you; you will need to supply a Java-style regular expression that identifies this text and specifically calls out the review ID inside that text. The regular expression is specified using the --review-id-regex hook command option. Here are some common ways of specifying the review ID and the corresponding regular expressions. Note that regular expressions are case-insensitive and you must identify the review ID portion with parenthesis:
This text can appear in-line with other text or in a more formal "form-style" layout. Because you control the regular expression, you can control exactly what this looks like. For more information about Git hooks in general, see the Git documentation. |
|
© 2003-2025 SmartBear Software. All rights reserved. |