pre-commit hook validating c++ code
-
16-10-2019 - |
Question
Today I've updated our repository and tried to recompile it (it's a c++ application). It doesn't compile. My first reaction was to kill my coworker, but because I can't do it I need to find another solution.
Is it possibile to prevent to commit code that doesn't compile? We have a Makefile and what the pre-commit hook need to do it's simpy to check the output status of the command make. Is it right?
How in pratice can I implement it (I've never work with svn hook)?
Solution
It's right in principle. However, it will likely cause major delays in committing (unless your application compiles in under a second). So you should really look for a different approach, where it lets users commit, but than starts a build process right away, and sends out email if it fails to build.
One way of doing that is buidbot.