]> git.phdru.name Git - git-scripts.git/blobdiff - hooks/post-checkout-compile
Add two post-checkout hooks as examples
[git-scripts.git] / hooks / post-checkout-compile
diff --git a/hooks/post-checkout-compile b/hooks/post-checkout-compile
new file mode 100755 (executable)
index 0000000..10c729b
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# post-checkout hook that compiles python files to byte code
+# if branch was changed
+
+prev_HEAD="$1"
+new_HEAD="$2"
+new_branch="$3"
+
+if [ \( "$new_branch" = 1 \) ]; then
+   python2.7 -m compileall -q . &&
+   python2.7 -O -m compileall -q .
+fi
+
+exit 0