Fix: [CocoaPods]Head and objects in .git directory

This commit is contained in:
lujian 2020-11-20 10:32:41 +08:00 committed by GitHub
parent 448f280772
commit d3064cc834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,8 +15,8 @@ function update_cocoapods_git() {
git remote set-url origin "$UPSTREAM" git remote set-url origin "$UPSTREAM"
/usr/bin/timeout -s INT 3600 git remote -v update -p /usr/bin/timeout -s INT 3600 git remote -v update -p
head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}') head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}')
[[ -n "$head" ]] && echo "ref: refs/heads/$head" > HEAD [[ -n "$head" ]] && echo "ref: refs/heads/$head" > .git/HEAD
objs=$(find objects -type f | wc -l) objs=$(find .git/objects -type f | wc -l)
[[ "$objs" -gt 8 ]] && git repack -a -b -d [[ "$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))