1 Star 0 Fork 0

mamh-mixed/tunasync-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cocoapods.sh 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
set -e
function repo_init() {
UPSTREAM=$1
WORKING_DIR=$2
git clone --mirror $UPSTREAM $WORKING_DIR
}
function update_cocoapods_git() {
UPSTREAM="$1"
repo_dir="$2"
cd $repo_dir
echo "==== SYNC $repo_dir START ===="
git remote set-url origin "$UPSTREAM"
/usr/bin/timeout -s INT 3600 git remote -v update -p
head=$(git remote show origin | awk '/HEAD branch:/ {print $NF}')
[[ -n "$head" ]] && echo "ref: refs/heads/$head" > HEAD
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 ===="
}
UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/CocoaPods"}
REPOS=("Specs")
total_size=0
for repo in ${REPOS[@]}; do
if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then
echo "Initializing ${repo}.git"
repo_init "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
fi
update_cocoapods_git "${UPSTREAM_BASE}/${repo}.git" "$TUNASYNC_WORKING_DIR/${repo}.git"
done
echo "Total size is" $(numfmt --to=iec $total_size)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mamh-mixed/tunasync-scripts.git
git@gitee.com:mamh-mixed/tunasync-scripts.git
mamh-mixed
tunasync-scripts
tunasync-scripts
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385