how to enforce "just commit after test"
The world of writing test is beautiful. But the problem is that with the time, some developers just "forget" (read: don't want, believe that its not necessary) to run all the test cases before the next commit and update test cases as the components are being updated.
using GIT, does exist a way to enforce "commit is just allowed after that the tests su开发者_C百科ccessfully ran" ?
update: i know the pre, post hook, but i look more for solutions, recepts and etc.
You can use a pre-commit hook on your blessed repository. Quoting the Git Community Book's entry on hooks:
GIT_DIR/hooks/pre-commit
This hook is invoked by 'git-commit', and can be bypassed with --no-verify option. It takes no parameter, and is invoked before obtaining the proposed commit log message and making a commit. Exiting with non-zero status from this script causes the 'git-commit' to abort.
You can set up a continuous integration server, which does run the tests each time new commits arrive a central repository. While this does not prevent the different developers to skip over the local test part, it can give direct feedback every time such an event occurs and send mails out to the whole team. The rest is how the team deals with persons who constantly breaks some rules.
精彩评论