summaryrefslogtreecommitdiffstats
path: root/git-hooks/post-merge
diff options
context:
space:
mode:
Diffstat (limited to 'git-hooks/post-merge')
-rwxr-xr-xgit-hooks/post-merge39
1 files changed, 39 insertions, 0 deletions
diff --git a/git-hooks/post-merge b/git-hooks/post-merge
new file mode 100755
index 000000000..ffcaa5bcc
--- /dev/null
+++ b/git-hooks/post-merge
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+if [[ -z "$GIT_DIR" ]]; then
+ GIT_DIR="$(dirname "$(realpath "$0")")/../.git"
+fi
+
+cd "$GIT_DIR/.."
+
+changes=$(git diff --name-only @{1} 2> /dev/null)
+fresh_clone=$?
+
+# Exit if nothing has changed
+if [ ! $fresh_clone ] && [[ -z "$changes" ]]; then
+ exit
+fi
+
+if echo "$changes" | grep scripts/install-git-hooks.sh; then
+ scripts/install-git-hooks.sh
+fi
+
+composer install --no-dev
+
+# Make sure submodules are up to date
+git submodule update --init --recursive
+
+# Update databse
+php index.php tools update_database
+
+# Minify javascript
+if echo "$changes" | grep data/js/ > /dev/null; then
+ scripts/optimize_js.sh
+fi
+
+if [[ ! -f ./data/js/main.min.js ]]; then
+ scripts/optimize_js.sh
+fi
+
+# Show changes to NEWS
+git diff @{1} NEWS 2> /dev/null | cat