editproj.cgi: Improve form layout alignment
[girocco.git] / jobd / gc.sh
blobe6819ef6537feff349f532d8ea6e321546aeb3b4
1 #!/bin/bash
3 . @basedir@/shlib.sh
5 set -e
6 trap 'if [ $? != 0 ]; then echo "gc failed dir: $PWD" >&2; fi; rm -f "$bang_log"' EXIT
8 proj="$1"
9 cd "$cfg_reporoot/$proj.git"
11 # date -R is linux-only, POSIX equivalent is '+%a, %d %b %Y %T %z'
12 datefmt='+%a, %d %b %Y %T %z'
14 if check_interval lastgc $cfg_min_gc_interval; then
15 progress "= [$proj] garbage check skip (last at $(config_get lastgc))"
16 exit 0
18 if [ -e .nogc ]; then
19 progress "x [$proj] garbage check disabled"
20 exit 0
22 progress "+ [$proj] garbage check (`date`)"
24 # safe pruning: we put all our objects in all forks, then we can
25 # safely get rid of extra ones; repacks in forks will get rid of
26 # the redundant ones again then
27 forkdir="$1"
28 if [ -d "../${forkdir##*/}" ]; then
29 get_repo_list "$forkdir/" |
30 while read fork; do
31 # Match objects in parent project
32 for d in objects/?? objects/pack; do
33 [ "$d" != "objects/??" ] || continue
34 mkdir -p "$cfg_reporoot/$fork.git/$d"
35 [ "$d" != "objects/pack" ] ||
36 [ "$(echo objects/pack/*)" != \
37 "objects/pack/*" ] || \
38 continue
39 ln -f "$d"/* "$cfg_reporoot/$fork.git/$d" ||:
40 done
42 # fixup project permissions
43 >"$cfg_fixup_queue" echo "$fork"
44 done
47 quiet=; [ -n "$show_progress" ] || quiet=-q
48 git repack -a -d --window-memory=1G -l $quiet
49 git prune
50 git update-server-info
51 config_set lastgc "$(date "$datefmt")"
53 progress "- [$proj] garbage check (`date`)"