logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

post-update (686B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. base=$(pwd|sed 's|\.git$||')
  5. update_f=' * Updating %s…'
  6. is_ok(){ echo ' [OK]'; }
  7. printf "$update_f" 'Garbage Collector'
  8. git gc && is_ok
  9. printf "$update_f" info
  10. git update-server-info && is_ok
  11. printf "$update_f" work
  12. 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
  13. if test -f "${base}.git/post-update.env" ; then
  14. . "${base}.git/post-update.env"
  15. fi
  16. for i in ${base}.git/hooks/post-update.*; do
  17. [[ -x $i ]] && echo "${PS4:-+}${i}" && $i
  18. done