avoid repacking every time

This commit is contained in:
z4yx 2020-03-25 15:12:09 +08:00
parent 00bc5bd38b
commit d1be4c0fbe
2 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,8 @@ function update_font_git() {
cd "$repo_dir" cd "$repo_dir"
echo "==== SYNC $repo_dir START ====" echo "==== SYNC $repo_dir START ===="
/usr/bin/timeout -s INT 3600 git remote -v update /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+') sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+')
total_size=$(($total_size+1024*$sz)) total_size=$(($total_size+1024*$sz))
echo "==== SYNC $repo_dir DONE ====" echo "==== SYNC $repo_dir DONE ===="

View File

@ -12,7 +12,8 @@ function update_cocoapods_git() {
cd $repo_dir cd $repo_dir
echo "==== SYNC $repo_dir START ====" echo "==== SYNC $repo_dir START ===="
/usr/bin/timeout -s INT 3600 git remote -v update /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+') sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+')
total_size=$(($total_size+1024*$sz)) total_size=$(($total_size+1024*$sz))
echo "==== SYNC $repo_dir DONE ====" echo "==== SYNC $repo_dir DONE ===="