summaryrefslogtreecommitdiffstats
path: root/git-hooks
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-05-04 00:28:51 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:27 +0200
commit9de52c2a252b8de46b10a57c8ff2e69c75cabdd3 (patch)
tree71defd01961f364059611f0ac1b14cfe74124341 /git-hooks
parentde444288bf67321d7306a317bff821959c81e766 (diff)
Add update script to git-hooks to be run after git pull
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/post-merge20
1 files changed, 20 insertions, 0 deletions
diff --git a/git-hooks/post-merge b/git-hooks/post-merge
new file mode 100755
index 000000000..4f4f5a994
--- /dev/null
+++ b/git-hooks/post-merge
@@ -0,0 +1,20 @@
+#!/usr/bin/bash
+
+if [[ -z "$GIT_DIR" ]]; then
+ GIT_DIR="$(dirname "$(realpath "$0")")/../.git"
+fi
+
+cd "$GIT_DIR/.."
+
+changes=$(git diff --name-only @{1})
+
+# Exit if nothing has changed
+[[ -z "$changes" ]] && exit
+
+# Update databse
+php index.php tools update_database
+
+# Minify javascript
+if echo "$changes" | grep data/js/ > /dev/null; then
+ scripts/optimize_js.sh
+fi