tag:blogger.com,1999:blog-291077727324465443.post2201051404538893562..comments2010-08-26T15:51:58.891-07:00Comments on Perl slices: Git - inhibit commit if modules don't compile-marco-http://www.blogger.com/profile/06648677532595327305noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-291077727324465443.post-89296506845525004872010-03-24T11:53:30.719-07:002010-03-24T11:53:30.719-07:00You have to be extremely careful with this. You ar...You have to be extremely careful with this. You aren't testing if your commit compiles, but if the working tree compiles. You should stash the changes (except for those in the index).<br /><br />My pre-commit hook looks like this:<br />git stash save --keep-index<br /><br />./runtests.py<br /><br />if [ $? = 0 ]; then<br /> exit 0;<br />else<br /> git stash pop;<br /> exit 1;<br />fi;<br /><br />And my post-commit hook looks like this:<br />git stash pop;<br /><br />I think there might still be a problem if I commit with --no-verify, though.Ian Calverthttps://www.blogger.com/profile/10598630812742024455noreply@blogger.com