3 # Girocco installs a pre-auto-gc hook.
4 # When $GIROCCO_DIVERT_GIT_SVN_AUTO_GC is set to 1
5 # that hook, when executed, runs this script and
6 # no matter what exit code this script uses, the
7 # pre-auto-gc hook always exits with a code of 1
8 # immediately after this script finishes thereby
9 # aborting any Git-directed gc.
11 # The `git-svn fetch` operation periodically runs
12 # `git gc --auto` which ultimately causes this
13 # script to run provided the correct conditions
14 # are met and $GIROCCO_DIVERT_GIT_SVN_AUTO_GC is
15 # set to 1 in the environment.
17 # Both the jobd/update.sh and taskd/clone.sh scripts
18 # set and export GIROCCO_DIVERT_GIT_SVN_AUTO_GC=1
19 # and force `gc.auto=1` as well whenever they process
23 . @basedir@
/jobd
/gc-util-functions.sh
27 [ -d objects
] ||
exit 1
29 v_get_proj_from_dir proj
33 packopts
="--depth=50 --window=50 --window-memory=${var_window_memory:-1g}"
34 quiet
="-q"; [ "${show_progress:-0}" = "0" ] || quiet
=
36 # pack any existing, non-packed loose objects into a new _l.pack file then run prune-packed
37 # note that prune-packed is NOT run beforehand -- the caller must do that if needed
38 # loose objects need not be part of complete commits/trees as --weak-naming is used
39 pack_incremental_loose_objects
() {
40 _lpacks
="$(run_combine_packs </dev/null --names --loose --weak-naming --incremental --non-empty --all-progress-implied ${quiet:---progress} $packopts)"
41 if [ -n "$_lpacks" ]; then
42 # We need to identify these packs later so we don't combine_packs them
43 for _objpack
in $_lpacks; do
44 rename_pack
"objects/pack/pack-$_objpack" "objects/pack/pack-${_objpack}_l" ||
:
46 git prune-packed
$quiet
50 if lotsa_loose_objects
; then
51 echo "Packing loose objects ($(date))"
52 pack_incremental_loose_objects
53 echo "Packing and pruning complete ($(date))"