diff options
| author | Franck Cuny <franckcuny@gmail.com> | 2016-07-02 20:06:31 -0700 |
|---|---|---|
| committer | Franck Cuny <franckcuny@gmail.com> | 2016-07-02 20:06:31 -0700 |
| commit | 4b8e43f75b394a4e6169884fbfb4c606865c6a22 (patch) | |
| tree | 48cae6b8e8f9b68cae29676d8a15cb3ddbfcccda /content/post/2009-04-14-git-and-prove.md | |
| parent | Stop using Jekyll. (diff) | |
| download | lumberjaph-4b8e43f75b394a4e6169884fbfb4c606865c6a22.tar.gz | |
Import migration from Jekyll to Hugo.
All the posts were converted, and the layout is created. This looks like
it works just fine.
Diffstat (limited to 'content/post/2009-04-14-git-and-prove.md')
| -rw-r--r-- | content/post/2009-04-14-git-and-prove.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/content/post/2009-04-14-git-and-prove.md b/content/post/2009-04-14-git-and-prove.md new file mode 100644 index 0000000..e7585f6 --- /dev/null +++ b/content/post/2009-04-14-git-and-prove.md @@ -0,0 +1,31 @@ +--- +date: 2009-04-14T00:00:00Z +summary: In which I add a hook to git to run my tests. +title: Git and prove +--- + +A little trick to force you to run your tests before a commit: + +in a repositorie, create the following file **.git/hooks/pre-commit** with this content: + +```sh +#!/bin/sh +if [ -d t ]; then + res=`prove t` + if [ $? -gt 0 ]; then + echo "tests fails" + exit 1 + fi +fi +if [ -d xt ]; then + res=`prove xt` + if [ $? -gt 0 ]; then + echo "tests fails" + exit 1 + fi +fi +``` + +and don't forget to chmod with +x. + +Now, when you will do your next commit, your test suit will be executed. If the tests fails, the commit will be rejected. |
