From d1be4c0fbe408d498fbc7c228f552d14d360db74 Mon Sep 17 00:00:00 2001 From: z4yx Date: Wed, 25 Mar 2020 15:12:09 +0800 Subject: [PATCH] avoid repacking every time --- adobe-fonts.sh | 3 ++- cocoapods.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/adobe-fonts.sh b/adobe-fonts.sh index 6714d14..e6c435f 100755 --- a/adobe-fonts.sh +++ b/adobe-fonts.sh @@ -14,7 +14,8 @@ function update_font_git() { cd "$repo_dir" echo "==== SYNC $repo_dir START ====" /usr/bin/timeout -s INT 3600 git remote -v update - git repack -a -b -d + objs=$(find objects -type f | wc -l) + [[ "$objs" -gt 8 ]] && git repack -a -b -d sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') total_size=$(($total_size+1024*$sz)) echo "==== SYNC $repo_dir DONE ====" diff --git a/cocoapods.sh b/cocoapods.sh index 0d4a35c..7a683ab 100755 --- a/cocoapods.sh +++ b/cocoapods.sh @@ -12,7 +12,8 @@ function update_cocoapods_git() { cd $repo_dir echo "==== SYNC $repo_dir START ====" /usr/bin/timeout -s INT 3600 git remote -v update - git repack -a -b -d + objs=$(find objects -type f | wc -l) + [[ "$objs" -gt 8 ]] && git repack -a -b -d sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') total_size=$(($total_size+1024*$sz)) echo "==== SYNC $repo_dir DONE ===="