On Tue, Aug 19, 2008 at 12:00:38PM -0700, Scott Chacon wrote:
If the patch is acceptable, I will update the githooks doc with more
information, but we would like this so that you could add a hook that
runs your automated tests before a push would go through.
I think the common wisdom has been that such tests should be done on the
_receiving_ end, since that makes a more trustworthy enforcement point.
E.g., I know that crap can't get into my central repo because a hook
checks everything coming in. But if a developer has turned off his
pre-push hook (or accidentally failed to enable it), he can still send
crap.
One other argument I have seen is that, to prevent the proliferation of
hooks, the rule is not to add a hook that could just as easily be done
as a sequence of commands. IOW, what's wrong with
run_my_automated_tests && git push
?
Off the top of my head, I guess the response to those two arguments
would be:
- sometimes the receiving end isn't set up to run tests, which means it
is more reasonable to do it on the sending side
- it's more convenient to just type "git push" than to remember "tests
&& git push", so this reduces the chances of contributors
accidentally pushing crap
-Peff