install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / hooks / post-commit
blobdcdb798dce263631c56cc29abdb1e9e02667113c
1 #!/bin/sh
3 # Provide another place for $Girocco::Config::autogchack to happen
5 # Beware, we MAY be running in a chroot!
7 # If GIROCCO_SUPPRESS_AUTO_GC_UPDATE immediately exit
8 [ "${GIROCCO_SUPPRESS_AUTO_GC_UPDATE:-0}" = "0" ] || exit 0
10 # If we're in the chroot immediately exit
11 [ -x @perlbin@ ] || exit 0
13 . @basedir@/shlib.sh
15 set -e
17 # Make sure the current directory is where we expect to be
18 [ "${GIT_DIR+set}" != "set" ] || { [ -n "$GIT_DIR" ] && [ -d "$GIT_DIR" ]; } || unset GIT_DIR
19 [ -n "$GIT_DIR" ] || GIT_DIR="$(git rev-parse --git-dir)"
20 [ -n "$GIT_DIR" ] && cd -P "${GIT_DIR:-.}" || exit 1
21 case "${PWD%/*}" in */worktrees)
22 # Gah!
24 # But it COULD just be a coincidence...
25 [ -s commondir ] && [ -s HEAD ] &&
26 _cmndir= && read -r _cmndir <commondir 2>/dev/null &&
27 [ -n "$_cmndir" ] && [ -d "$_cmndir" ]
28 then
29 # ...it is not, fix it!
30 cd -P "$_cmndir" || exit 1
32 esac
33 GIT_DIR="." GIT_PREFIX= && export GIT_DIR
35 # Get out of the mob
36 case "$PWD" in *?/mob)
37 cd ..
38 GIROCCO_PERSONAL_MOB=1
39 esac
41 umask 002
43 # just in case
44 check_and_set_needsgc
46 _shlib_done=1
47 unset GIROCCO_SUPPRESS_AUTO_GC_UPDATE
48 . "$cfg_basedir/jobd/generate-auto-gc-update.sh"
49 generate_auto_gc_update
51 # if there's been a commit, the cache is definitely outdated
52 # we always do this now in case the autogchack is not active
53 ! [ -d htmlcache ] || { >htmlcache/changed; } 2>/dev/null || :
55 exit 0