post-commit: always touch htmlcache/changed
[girocco/readme.git] / hooks / post-commit
blobd9cfac202dda0de730ebe610e50e4da462139cbd
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" ] || cd "${GIT_DIR:-.}" || exit 1
19 case "${PWD%/*}" in */worktrees)
20 # Gah!
22 # But it COULD just be a coincidence...
23 [ -s commondir ] && [ -s HEAD ] &&
24 _cmndir= && read -r _cmndir <commondir 2>/dev/null &&
25 [ -n "$_cmndir" ] && [ -d "$_cmndir" ]
26 then
27 # ...it is not, fix it!
28 cd "$_cmndir" || exit 1
30 esac
31 [ "${GIT_DIR+set}" != "set" ] || GIT_DIR="."
33 # Get out of the mob
34 case "$PWD" in *?/mob)
35 cd ..
36 GIROCCO_PERSONAL_MOB=1
37 esac
39 umask 002
41 # just in case
42 check_and_set_needsgc
44 _shlib_done=1
45 unset GIROCCO_SUPPRESS_AUTO_GC_UPDATE
46 . "$cfg_basedir/jobd/generate-auto-gc-update.sh"
47 generate_auto_gc_update
49 # if there's been a commit, the cache is definitely outdated
50 # we always do this now in case the autogchack is not active
51 ! [ -d htmlcache ] || { >htmlcache/changed; } 2>/dev/null || :
53 exit 0