6 trap 'if [ $? != 0 ]; then echo "gc failed dir: $PWD" >&2; fi; rm -f "$bang_log"' EXIT
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))"
19 progress
"x [$proj] garbage check disabled"
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
28 if [ -d "../${forkdir##*/}" ]; then
29 # It is enough to copy objects just one level down and get_repo_list
30 # takes a regular expression (which is automatically prefixed with '^')
31 # so we can easily match forks exactly one level down from this project
32 get_repo_list
"$forkdir/[^/]*:" |
34 # Ignore forks that do not exist or are symbolic links
35 [ ! -L "$cfg_reporoot/$fork.git" -a -d "$cfg_reporoot/$fork.git" ] || \
37 # Match objects in parent project
38 for d
in objects
/?? objects
/pack
; do
39 [ "$d" != "objects/??" ] ||
continue
40 mkdir
-p "$cfg_reporoot/$fork.git/$d"
41 [ "$d" != "objects/pack" ] || \
42 [ "$(echo objects/pack/*)" != \
43 "objects/pack/*" ] || \
45 ln -f "$d"/* "$cfg_reporoot/$fork.git/$d" ||
:
50 quiet
=; [ -n "$show_progress" ] || quiet
=-q
51 git repack
-a -d --window-memory=1G
-l $quiet
53 git update-server-info
54 config_set lastgc
"$(date "$datefmt")"
56 progress
"- [$proj] garbage check (`date`)"