get_repo_list users: Fix for the fact that .git suffix is not returned
[girocco/radio.git] / jobs / gc.sh
blob51850ec8f8b6bbbbf3024bef9f984e857f88be29
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 dir="$1.git"
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="$1"
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.git/$d"
21 ln -f "$d"/* "$cfg_reporoot/$forkdir/$fork.git/$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"