blob: 1fc8b582cb0a258c2e912d02746ceb41a29870dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/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
# 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
|