From 7f974d528b97f180141c40c59df40243b2b553b4 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 11 Aug 2021 18:22:03 -0700 Subject: [PATCH] jobd/gc.sh: make sure all refs get packed at gc time If there are any refs in the private refs area, make sure that they get packed too at the same time refs in the main area do. Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/jobd/gc.sh b/jobd/gc.sh index f6a1a4e..f6fccf2 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -720,6 +720,17 @@ if [ -z "$isminigc" ] && [ -e .delaygc ] && [ -e .needsgc ]; then progress "~ [$proj] garbage check delayed but checking mini because .needsgc" fi +# git_pack_refs_all_prune +# run `git pack-refs --all --prune` in the current directory +# if an is_git_dir "private" refs subdirectory exists, +# then run `git --git-dir=private pack-refs --all --prune` too +# (since mini gc uses this it has to be defined before that) +git_pack_refs_all_prune() { + # The "--prune" option is the default since v1.5.0 but it serves as "documentation" here + git pack-refs --all --prune + ! is_git_dir private || git --git-dir=private pack-refs --all --prune +} + if [ -n "$isminigc" ]; then # Perform a "mini" gc # Note that .delaygc is ignored here as that's only intended for full gc @@ -763,7 +774,7 @@ if [ -n "$isminigc" ]; then progress "+ [$proj] mini garbage check ($(date))" fi # if we have at least 10 packs go ahead and pack all refs now too - git pack-refs --all --prune + git_pack_refs_all_prune if [ -n "$gfi_mirror" ]; then repack_gfi_packs packcnt="$(list_packs --count $lpo objects/pack)" || : @@ -1209,8 +1220,7 @@ cat_all_ref_logs() { # # Everything else is more efficient if we do this first -# The "--prune" option is the default since v1.5.0 but it serves as "documentation" here -git pack-refs --all --prune +git_pack_refs_all_prune [ -e packed-refs ] || >>packed-refs # should never happen... # We didn't used to do anything about rerere or worktrees but we're -- 2.11.4.GIT