]>
git.mar77i.info Git - mar77i.info/blob - post-receive.sh
3 read -r -d '' hook
<<'EOF'
5 while read _ _ refname; do
6 if [[ "${refname}" == refs/heads/master ]]; then
7 . <(git show master:post-receive.sh)
13 hook_hash
="$(printf '%s' "${hook}"|sha256sum| cut -d\ -f1)"
14 [[ -f "${dest}" ]] && current_hash
="$(sha256sum hooks/post-receive| cut -d\ -f1)"
18 for (( i
= 1; i
< $# + 1; i
++ )); do
25 update_post_receive_hook
() {
26 local stat_cmd
="\$(stat -c %a hooks/post-receive)"
27 print_and_run bash
-c "cat >hooks/post-receive <<'EOF'"$
'\n'"${hook}"$
'\nEOF\n'
28 print_and_run bash
-c "[[ ${stat_cmd} == 755 ]] || chmod 755 hooks/post-receive"
31 if [[ "${1}" == --install ]]; then
33 echo "Error: No further arguments expected." >&2
36 update_post_receive_hook
40 [[ "${hook_hash}" != "${current_hash}" ]] && update_post_receive_hook
42 echo "There's currently nothing to do" | tee "${HOME}/webroot/www.mar77i.info/index.html"