From 16a1d5ec36589aee7e595823da19932a299d02e5 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 23 Aug 2016 14:55:24 -0700 Subject: [PATCH] gc.sh: support girocco.redelta=always config If `git config girocco.redelta` is "always" then for the final repack on a full gc, deltas will always be recomputed regardless of the value of $var_redelta_threshold or how many objects are actually present. This can be used to force a repository to stay as optimized as possible even if it execeeds the normal redelta threshold. However, care must be used as setting girocco.redelta=always on a repository with an extremely excessive number of objects will likely cause either a memory blowout or a gc timeout. Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jobd/gc.sh b/jobd/gc.sh index cf6ba2d..d59d8ef 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -325,11 +325,15 @@ cd "$cfg_reporoot/$proj.git" # If git config --bool --get girocco.redelta is explicitly false then automatic # redelta when there are less than $var_redelta_threshold objects will be suppressed. +# On the other hand, if git config --get girocco.redelta is "always" then, on a full +# gc only, for the final repack, deltas will always be recomputed. # This can be set on a per-project basis to avoid unusual pathological gc behavior. # Setting this will hurt efficiency of the affected repository. # Note that fast-import packs ALWAYS get new deltas regardless of this setting. noreusedeltaopt="--no-reuse-delta" [ "$(git config --bool --get girocco.redelta 2>/dev/null || :)" != "false" ] || noreusedeltaopt= +alwaysredelta= +[ "$(git config --get girocco.redelta 2>/dev/null || :)" != "always" ] || alwaysredelta=1 trap 'e=$?; rm -f .gc_in_progress; if [ $e != 0 ]; then echo "gc failed dir: $PWD" >&2; fi' EXIT trap 'exit 130' INT @@ -485,7 +489,8 @@ fi progress "+ [$proj] garbage check (`date`)" newdeltas= -if [ -f gfi-packs -a -s gfi-packs ] && is_gfi_mirror; then +[ -z "$alwaysredelta" ] || newdeltas=-f +if [ -z "$newdeltas" ] && [ -f gfi-packs -a -s gfi-packs ] && is_gfi_mirror; then if [ $(list_packs --exclude-no-idx --count objects/pack) -le \ $(list_packs --exclude-no-idx --count --quiet --only gfi-packs) ]; then # Don't bother with repack_gfi_packs since everything's being repacked -- 2.11.4.GIT