Girocco/TimedToken.pm: add support for timed tokens
[girocco.git] / jobd / gc-git-svn.sh
blob7d29b8f348e4d828b45caf07afc1fcd3990a2672
1 #!/bin/sh
3 # Girocco installs a pre-auto-gc hook.
4 # When $GIROCCO_DIVERT_GIT_SVN_AUTO_GC is set to 1
5 # that hook, when executed, runs this script and
6 # no matter what exit code this script uses, the
7 # pre-auto-gc hook always exits with a code of 1
8 # immediately after this script finishes thereby
9 # aborting any Git-directed gc.
11 # The `git-svn fetch` operation periodically runs
12 # `git gc --auto` which ultimately causes this
13 # script to run provided the correct conditions
14 # are met and $GIROCCO_DIVERT_GIT_SVN_AUTO_GC is
15 # set to 1 in the environment.
17 # Both the jobd/update.sh and taskd/clone.sh scripts
18 # set and export GIROCCO_DIVERT_GIT_SVN_AUTO_GC=1
19 # and force `gc.auto=1` as well whenever they process
20 # a `git-svn` mirror.
22 . @basedir@/shlib.sh
23 . @basedir@/jobd/gc-util-functions.sh
25 set -e
27 [ -d objects ] || exit 1
29 umask 002
30 [ "$cfg_permission_control" != "Hooks" ] || umask 000
32 v_get_proj_from_dir proj
33 proj="${proj%.git}"
35 if lotsa_loose_objects_or_sopacks; then
36 echo "Packing loose objects ($(date))"
37 if pack_incremental_loose_objects_if_lockable; then
38 echo "Packing and pruning complete ($(date))"
39 else
40 echo "Packing skipped: $lockerr ($(date))"
44 exit 0