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 get_repo_list
"$forkdir/" |
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/*" ] || \
39 ln -f "$d"/* "$cfg_reporoot/$fork.git/$d" ||
:
42 # fixup project permissions
43 >"$cfg_fixup_queue" echo "$fork"
47 quiet
=; [ -n "$show_progress" ] || quiet
=-q
48 git repack
-a -d --window-memory=1G
-l $quiet
50 git update-server-info
51 config_set lastgc
"$(date "$datefmt")"
53 progress
"- [$proj] garbage check (`date`)"