Girocco::Project::_alternates_setup(): Stop creating the forkee symlink
[girocco/mytab.git] / daemons / gc.sh
blob13661317a472c0eb56446fde8378850cf3309c05
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_intreval; then
11 progress "= [$proj] garbage check skip (last at $(config_get lastgc))"
12 exit 0
14 progress "+ [$proj] garbage check (`date`)"
16 # safe pruning: we put all our objects to all forks, then we can
17 # safely get rid of extra ones; repacks in forks will get rid of
18 # the redundant ones again then
19 forkdir="$1"
20 if [ -d "$forkdir" ]; then
21 get_repo_list "$forkdir/" |
22 while read fork; do
23 # Match objects in parent project
24 for d in objects/?? objects/pack; do
25 [ "$d" != "objects/??" ] || continue
26 mkdir -p "$cfg_reporoot/$forkdir/$fork.git/$d"
27 ln -f "$d"/* "$cfg_reporoot/$forkdir/$fork.git/$d"
28 done
29 done
32 quiet=; [ -n "$show_progress" ] || quiet=-q
33 git repack -A -d --window-memory=3G -l $quiet
34 git prune
35 git update-server-info
36 config_set lastgc "$(date -R)"
38 progress "- [$proj] garbage check (`date`)"