jobs/gccheck.sh: Split off one-repo worker to jobs/gc.sh
[girocco.git] / jobs / gc.sh
blobf27715397bc088f7cf05206805b38deb771fa20d
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 dir="$1"
7 progress "+ `date` $dir"
9 # safe pruning: we put all our objects to all forks, then we can
10 # safely get rid of extra ones; repacks in forks will get rid of
11 # the redundant ones again then
12 forkdir="${dir%.git}"
13 if [ -d "$forkdir" ]; then
14 pushd "$cfg_reporoot/$dir"
15 get_repo_list "$forkdir/" |
16 while read fork; do
17 # Match objects in parent project
18 for d in objects/?? objects/pack; do
19 [ "$d" != "objects/??" ] || continue
20 mkdir -p "$cfg_reporoot/$forkdir/$fork/$d"
21 ln -f "$d"/* "$cfg_reporoot/$forkdir/$fork/$d"
22 done
23 done
24 popd
27 git --git-dir="$dir" repack -A -d --window-memory=3G -l -q
28 git --git-dir="$dir" prune
29 git --git-dir="$dir" update-server-info
30 date -R >"$dir/.last_gc"
32 progress "- `date` $dir"