scripts: purge use of test '-a' and '-o' ops and clean up
[girocco.git] / toolbox / project-changed.sh
blobd6505cf25df15516bcddd2c0cd43ff6275321cfe
1 #!/bin/sh
3 # A project has been changed outside Girocco, take suitable action.
5 # This scripit should be run for a project whenever:
7 # 1) It's been renamed (use the new name and run AFTER renaming)
8 # 2) The project's owner (or any other .git/config value) has been changed
9 # 3) Any of the project's refs have been changed (including the HEAD symref)
10 # 4) The project was manually changed in some other way and you're unsure
12 # Normally Girocco automatically takes care of everything this script does;
13 # so this script only ever need be run if an administrator manually makes
14 # changes to a project.
16 set -e
18 . @basedir@/shlib.sh
20 umask 002
22 p="${1%.git}"
23 if [ "$#" -ne 1 ] || [ -z "$p" ]; then
24 echo "I need a project name (e.g. \"$(basename "$0") example\")"
25 exit 1
27 "$cfg_basedir/gitweb/genindex.sh" "$p" || :
28 if [ -d "$cfg_reporoot/$p.git" ]; then
29 ! [ -d "$cfg_reporoot/$p.git/htmlcache" ] ||
30 >"$cfg_reporoot/$p.git/htmlcache/changed"
31 else
32 echo "WARNING: no such directory: $cfg_reporoot/$p.git"
33 echo "WARNING: but the project list file was updated anyway"