From 4df2625852b06afae7fa1be508c298a45aeb939e Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 10 Jun 2020 01:44:13 -0700 Subject: [PATCH] shlib.sh: move vcnt function into shlib as v_cnt Signed-off-by: Kyle J. McKay --- jobd/gc.sh | 12 ++++-------- shlib.sh | 6 ++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/jobd/gc.sh b/jobd/gc.sh index 358f40a..c6d315a 100755 --- a/jobd/gc.sh +++ b/jobd/gc.sh @@ -25,10 +25,6 @@ umask 002 [ "$cfg_permission_control" != "Hooks" ] || umask 000 clean_git_env -vcnt() { - eval "$1="'$(( $# - 1 ))' -} - pidactive() { if _result="$(kill -0 "$1" 2>&1)"; then # process exists and we have permission to signal it @@ -160,7 +156,7 @@ compact_reflogs() { # there's one pack but not any refs is_dirty() { _packs="$(find -L objects/pack -name "pre-auto-gc-[12].pack" -prune -o -name "*.pack" -type f -print 2>/dev/null | head -n 2)" - vcnt _packscnt $_packs + v_cnt _packscnt $_packs if [ $_packscnt -gt 1 ]; then return 0 fi @@ -251,7 +247,7 @@ combine_small_packs() { _didprogress=1 } _newp="$(list_packs $_lpo | combine_packs --names $noreusedeltaopt)" - vcnt _newc $_newp + v_cnt _newc $_newp # be paranoid and exit the loop if we haven't reduced the number of packs [ $_newc -lt $_cnt ] || break _minsmallpacks=2 @@ -284,7 +280,7 @@ combine_small_loose_packs() { for _objpack in $_newp; do rename_pack "objects/pack/pack-$_objpack" "objects/pack/pack-${_objpack}_l" || : done - vcnt _newc $_newp + v_cnt _newc $_newp # be paranoid and exit the loop if we haven't reduced the number of packs [ $_newc -lt $_cnt ] || break _minsmallpacks=2 @@ -1407,7 +1403,7 @@ sleep 1 # tagged commits packs="$(git --git-dir=repack pack-objects