mirroring/cloned.pl -> daemons/cloned.pl
[girocco/radio.git] / jobs / gccheck.sh
blob7219edc81f4fc1481af54ae5b0644f52fcf49dca
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 if [ -e /tmp/gitupdatelock ]; then
6 echo "Locked!" >&2
7 exit 1
8 fi
9 touch /tmp/gitupdatelock
11 rootdir="$cfg_reporoot"
13 repack()
15 dir="$1"
16 progress "+ `date` $dir"
17 # safe pruning: we put all our objects to all forks, then we can
18 # safely get rid of extra ones; repacks in forks will get rid of
19 # the redundant ones again then
20 forkdir="${dir%.git}"
21 if [ -d "$forkdir" ]; then
22 pushd "$rootdir/$dir"
23 get_repo_list "$forkdir/" |
24 while read fork; do
25 # Match objects in parent project
26 for d in objects/?? objects/pack; do
27 [ "$d" != "objects/??" ] || continue
28 mkdir -p "$rootdir/$forkdir/$fork/$d"
29 ln -f "$d"/* "$rootdir/$forkdir/$fork/$d"
30 done
31 done
32 popd
35 git --git-dir="$dir" repack -A -d --window-memory=3G -l -q
36 git --git-dir="$dir" prune
37 git --git-dir="$dir" update-server-info
38 date -R >"$dir/.last_gc"
39 progress "- `date` $dir"
42 get_repo_list |
43 while read dir; do
44 repack "$dir"
45 done 2>&1 | grep -v '^Pack.*created\.$'
47 rm /tmp/gitupdatelock