jobd/update.sh: Fix ref-change line, $ref at the end
[girocco.git] / jobd / gc.sh
blobbc561455f2a83b32b6bbdb9e959b92300cf4b12f
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 set -e
7 proj="$1"
8 cd "$cfg_reporoot/$proj.git"
10 if check_interval lastgc $cfg_min_gc_interval; then
11 progress "= [$proj] garbage check skip (last at $(config_get lastgc))"
12 exit 0
14 if [ -e .nogc ]; then
15 progress "x [$proj] garbage check disabled"
16 exit 0
18 progress "+ [$proj] garbage check (`date`)"
20 # safe pruning: we put all our objects to all forks, then we can
21 # safely get rid of extra ones; repacks in forks will get rid of
22 # the redundant ones again then
23 forkdir="$1"
24 if [ -d "$forkdir" ]; then
25 get_repo_list "$forkdir/" |
26 while read fork; do
27 # Match objects in parent project
28 for d in objects/?? objects/pack; do
29 [ "$d" != "objects/??" ] || continue
30 mkdir -p "$cfg_reporoot/$forkdir/$fork.git/$d"
31 ln -f "$d"/* "$cfg_reporoot/$forkdir/$fork.git/$d"
32 done
33 done
36 quiet=; [ -n "$show_progress" ] || quiet=-q
37 git repack -a -d --window-memory=1G -l $quiet
38 git prune
39 git update-server-info
40 config_set lastgc "$(date -R)"
42 progress "- [$proj] garbage check (`date`)"