Git server and client are not much different ;-). Thus, all interceptions launched on the "client" will be performed on the "server", unless, of course, the same events occur on the server.
For example, update hook, completely falls into this category. It is called after updating the branch, and if this hook returns a non-zero status, the update is canceled. Therefore, you may want to put the compilation there and return its result. All messages that you print using the hook will be shown to the user who commits on his console. This is very convenient as it can see error messages from your build script and fix it.
Even if you run two compilations at the same time, the git repository will not lose commit due to the use of the "old refname" argument in its update hook. However, it may happen that the committer is waiting for compilation, and its reflector is not pressed, because someone else made it click.
The default git repository contains a good example of the update hook (named update.sample ). Refer to it if you need a final example.
However, if the compilation is too long, and the commit speed exceeds the frequency with which you can compile your code, you can use more complex solutions. Browsers suggest looking for "continuous integration" on google.
Pavel shved
source share