From afa5dce5658e8338aba10ee072743060beacfdcf Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 30 Nov 2016 00:55:53 -0800 Subject: [PATCH] clone.sh/update.sh: set fastimport.unpackLimit to 0 Prior to Git v2.10.0 fast-import always produced packs and terrible ones at that. Starting with Git v2.10.0 it still produces horrible packs but will unpack them by default if they have 100 or fewer objects in them. We prefer the old behavior so we must set fastimport.unpackLimit to 0. Note that the documentation says less than, but the code implements it as less than or equal so we need to use 0 for fastimport.unpackLimit whereas for the other three settings we need to use 1 because they are properly implemented as < and because a setting of 0 means something else for one of them. Fortunately, setting fastimport.unpackLimit does correctly override transfer.unpackLimit in the new code in contrast to the reverse in the old code for the other three settings so we can successfully set the fastimport limit to 0 while the others are set to 1. Signed-off-by: Kyle J. McKay --- jobd/update.sh | 14 ++++++++++---- taskd/clone.sh | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/jobd/update.sh b/jobd/update.sh index 5f091d1..b970a1f 100755 --- a/jobd/update.sh +++ b/jobd/update.sh @@ -168,6 +168,16 @@ bang_eval "LC_ALL=C sort -b -k1,1 <.refs-temp >.refs-before" ! [ -e .delaygc ] || >.allowgc || : svnpackcreated= +# Make sure we don't get any unwanted loose objects +# Starting with Git v2.10.0 fast-import can generate loose objects unless we +# tweak its configuration to prevent that +git_add_config 'fetch.unpackLimit=1' +# Note the git config documentation is wrong +# transfer.unpackLimit, if set, overrides fetch.unpackLimit +git_add_config 'transfer.unpackLimit=1' +# But not the Git v2.10.0 and later fastimport.unpackLimit which improperly uses <= instead of < +git_add_config 'fastimport.unpackLimit=0' + case "$url" in svn://* | svn+http://* | svn+https://* | svn+file://* | svn+ssh://*) [ -n "$cfg_mirror_svn" ] || { echo "Mirroring svn is disabled" >&2; exit 0; } @@ -279,10 +289,6 @@ case "$url" in [ "$url" = "$(git config --get remote.origin.url || :)" ] || bang config_set_raw remote.origin.url "$url" pruneopt=--prune [ "$(git config --bool fetch.prune 2>/dev/null || :)" != "false" ] || pruneopt= - git_add_config 'fetch.unpackLimit=1' - # Note the git config documentation is wrong - # transfer.unpackLimit, if set, overrides fetch.unpackLimit - git_add_config 'transfer.unpackLimit=1' if ! is_gfi_mirror_url "$url"; then lastwasclean= [ "$(git config --bool girocco.lastupdateclean 2>/dev/null || :)" != "true" ] || lastwasclean=1 diff --git a/taskd/clone.sh b/taskd/clone.sh index ce7551a..45fbd07 100755 --- a/taskd/clone.sh +++ b/taskd/clone.sh @@ -196,6 +196,16 @@ mailaddrs="$(config_get owner || :)" [ -z "$cfg_admin" ] || \ if [ -z "$mailaddrs" ]; then mailaddrs="$cfg_admin"; else mailaddrs="$mailaddrs,$cfg_admin"; fi +# Make sure we don't get any unwanted loose objects +# Starting with Git v2.10.0 fast-import can generate loose objects unless we +# tweak its configuration to prevent that +git_add_config 'fetch.unpackLimit=1' +# Note the git config documentation is wrong +# transfer.unpackLimit, if set, overrides fetch.unpackLimit +git_add_config 'transfer.unpackLimit=1' +# But not the Git v2.10.0 and later fastimport.unpackLimit which improperly uses <= instead of < +git_add_config 'fastimport.unpackLimit=0' + # Initial mirror echo "Initiating mirroring..." headref= @@ -398,10 +408,6 @@ case "$url" in git symbolic-ref HEAD "$headref" pruneopt=--prune [ "$(git config --bool fetch.prune 2>/dev/null || :)" != "false" ] || pruneopt= - git_add_config 'fetch.unpackLimit=1' - # Note the git config documentation is wrong - # transfer.unpackLimit, if set, overrides fetch.unpackLimit - git_add_config 'transfer.unpackLimit=1' # remember the starting time so we can easily detect new packs for fast-import mirrors # we sleep for 1 second after creating .gfipack to make sure all packs are newer if is_gfi_mirror_url "$url" && [ ! -e .gfipack ]; then -- 2.11.4.GIT