From e6013a109c84a7b64e1ba89163e6911a7e401518 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 1 Jun 2016 19:21:19 -0700 Subject: [PATCH] gc.sh: combine loose git-svn fetch objects into a pack Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/jobd/gc.sh b/jobd/gc.sh index 80faffa..6381804 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -108,6 +108,33 @@ combine_small_packs() { return 0 } +# Unfortunately git-svn lacks the ability to store newly fetched revisions as a pack. +# However, the fetch code conveniently sets .svnpack just before it runs git-svn fetch +# so that it's easy to find all the objects that have been fetched by git-svn and +# combine them into a pack. The --no-reuse-delta option is meaningless here since +# everything to be packed is a loose object and therefore not a delta so deltification +# will always take place. +make_svn_pack() { + [ -f .svnpack ] && is_svn_mirror || return 0 + rm -f .svnpackgc + mv -f .svnpack .svnpackgc + _newp="$(find objects/$octet -maxdepth 1 -type f -newer .svnpackgc -name "$octet19" -print 2>/dev/null | + awk -F / '{print $2 $3}' | + @basedir@/jobd/combine-packs.sh --objects --names $packopts --incremental --all-progress-implied $quiet --non-empty)" || { + mv -f .svnpackgc .svnpack + >.gc_failed + return 1 + } + if [ -n "$_newp" ]; then + # remove the now-redundant loose objects -- this is always safe + # even during a concurrent push because a reprepare_packed_git + # will be triggered if an object that should be there is not + # found thereby finding it in the new pack instead + git prune-packed $quiet + fi + rm -f .svnpackgc +} + # HEADSHA="$(pack_is_complete /full/path/to/some.pack /full/path/to/packed-refs "$(cat HEAD)")" pack_is_complete() { # Must have a matching .idx file and a non-empty packed-refs file @@ -380,6 +407,7 @@ if [ -z "$newdeltas" ]; then # maintenance and by doing it before we copy objects down to forks we reduce # the amount that gets sprayed into the forks' objects directories repack_gfi_packs + make_svn_pack combine_small_packs fi -- 2.11.4.GIT