diff options
-rwxr-xr-x | hooks/post-receive | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hooks/post-receive b/hooks/post-receive index 8022e90..bcba4a6 100755 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -4,6 +4,7 @@ set -euo pipefail deploy() { local path="${1}" + local -i compile=0 # Deploy any pages that were changed for i in ${FILES_E[*]} ${FILES_A[*]} ${FILES_M[*]}; do @@ -22,7 +23,9 @@ deploy() { "$(date '+%F %T %Z')" >> "${dest}" elif [ "${i%%/*}" = 'src' ]; then - (cd src && make && make install DEPLOYDIR="${path}") + # Set compile = 1 and compile after parsing all files, or compilation + # will happen once per changed file in src. + compile=1 # Skip processing the hooks dir elif [ "${i%%/*}" = 'hooks' ]; then @@ -34,6 +37,10 @@ deploy() { fi done + # Compile if required + if [ "${compile:-0}" = 1 ]; then + (cd src && make && make install DEPLOYDIR="${path}") + fi } cleanup() { |