post-update (686B)
- #!/bin/sh
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- base=$(pwd|sed 's|\.git$||')
- update_f=' * Updating %s…'
- is_ok(){ echo ' [OK]'; }
- printf "$update_f" 'Garbage Collector'
- git gc && is_ok
- printf "$update_f" info
- git update-server-info && is_ok
- printf "$update_f" work
- mkdir -p "${base}.work/.git" && GIT_INDEX_FILE="${base}.work/.git/index" git --work-tree="${base}.work" --git-dir="${base}.git" checkout -f && is_ok
- if test -f "${base}.git/post-update.env" ; then
- . "${base}.git/post-update.env"
- fi
- for i in ${base}.git/hooks/post-update.*; do
- [[ -x $i ]] && echo "${PS4:-+}${i}" && $i
- done