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)
15 for (( i
= 1; i
< $# + 1; i
++ )); do
22 update_post_receive_hook
() {
23 local stat_cmd
="\$(stat -c %a hooks/post-receive)"
24 print_and_run bash
-c "cat >hooks/post-receive <<'EOF'"$
'\n'"${hook}"$
'\nEOF\n'
25 print_and_run bash
-c "[[ ${stat_cmd} == 755 ]] || chmod 755 hooks/post-receive"
28 if [[ "${1}" == --install ]]; then
30 echo "Error: No further arguments expected." >&2
33 update_post_receive_hook
37 hook_hash
="$(printf '%s' "${hook}"|sha256sum| cut -d\ -f1)"
38 [[ -f "${dest}" ]] && current_hash
="$(sha256sum hooks/post-receive| cut -d\ -f1)"
39 [[ "${hook_hash}" != "${current_hash}" ]] && update_post_receive_hook
41 update_gitweb_theme
() {
42 local theme_css_dest
="${HOME}/gitweb/gitweb-theme.css"
43 print_and_run bash
-c "git show master:gitweb-theme.css > \"${theme_css_dest}\""
46 update_gitweb_configs
() {
47 print_and_run bash
-c 'python <(git show master:gitweb_configs.py)'
50 tasks
=(update_gitweb_theme update_gitweb_configs
)
52 for task
in "${tasks[@]}"; do