From 3115f10f41ae0e7bf95852c05bc041be3c7c8af6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 16 Aug 2015 11:47:14 -0700 Subject: [PATCH] gc.sh: only copy down .pack and .idx pack files When hard-linking the parents objects and packs into the child fork, avoid extraneous pack files (such as pack-*.bitmap). Only copy down the loose objects and pack .idx and .pack files. This prevents a situation where a fork can end up seeing more than one .bitmap file (the old one that was copied in and the new one generated in the parent). The git client will display a warning message if more than one .bitmap file is visible and we want to avoid that. Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/jobd/gc.sh b/jobd/gc.sh index a9c6a96..c4fd2d1 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -317,7 +317,8 @@ progress "+ [$proj] garbage check (`date`)" # safe pruning: we put all our objects in all forks, then we can # safely get rid of extra ones; repacks in forks will get rid of -# the redundant ones again then +# the redundant ones again then; we carefully grab only loose +# objects and pack .idx and .pack files forkdir="$proj" if [ -d "../${forkdir##*/}" ]; then # It is enough to copy objects just one level down and get_repo_list @@ -332,15 +333,18 @@ if [ -d "../${forkdir##*/}" ]; then [ -s "$cfg_reporoot/$fork.git/objects/info/alternates" ] || \ continue # Match objects in parent project - for d in objects/?? objects/pack; do + for d in objects/??; do [ "$d" != "objects/??" ] || continue mkdir -p "$cfg_reporoot/$fork.git/$d" - [ "$d" != "objects/pack" ] || \ - [ "$(echo objects/pack/*)" != \ - "objects/pack/*" ] || \ - continue ln -f "$d"/* "$cfg_reporoot/$fork.git/$d" || : done + # Match packs in parent project + mkdir -p "$cfg_reporoot/$fork.git/objects/pack" + if [ "$(echo objects/pack/pack-*.idx)" != \ + "objects/pack/pack-*.idx" ]; then + ln -f objects/pack/pack-*.pack "$cfg_reporoot/$fork.git/objects/pack" || : + ln -f objects/pack/pack-*.idx "$cfg_reporoot/$fork.git/objects/pack" || : + fi # Update the fork's lastparentgc date (must be current, not $gcstart) GIT_DIR="$cfg_reporoot/$fork.git" git config \ gitweb.lastparentgc "$(date "$datefmt")" -- 2.11.4.GIT