From 633c7116dc91921764cf92257ec3c896943730cb Mon Sep 17 00:00:00 2001 From: z4yx Date: Mon, 27 Apr 2020 13:16:44 +0800 Subject: [PATCH] [git scripts] add --prune, update remotes/origin/HEAD --- adobe-fonts.sh | 3 ++- cocoapods.sh | 3 ++- git-repo.sh | 3 ++- git.sh | 3 ++- homebrew.sh | 3 ++- llvm.sh | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/adobe-fonts.sh b/adobe-fonts.sh index e6c435f..83fef63 100755 --- a/adobe-fonts.sh +++ b/adobe-fonts.sh @@ -13,7 +13,8 @@ function update_font_git() { repo_dir="$1" cd "$repo_dir" 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 -p + git remote set-head origin --auto 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+') diff --git a/cocoapods.sh b/cocoapods.sh index 7a683ab..a561143 100755 --- a/cocoapods.sh +++ b/cocoapods.sh @@ -11,7 +11,8 @@ function update_cocoapods_git() { repo_dir="$1" cd $repo_dir 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 -p + git remote set-head origin --auto 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+') diff --git a/git-repo.sh b/git-repo.sh index f5b3b3d..490286e 100755 --- a/git-repo.sh +++ b/git-repo.sh @@ -8,7 +8,8 @@ function repo_init() { function update_repo_git() { cd $TUNASYNC_WORKING_DIR echo "==== SYNC repo.git START ====" - /usr/bin/timeout -s INT 3600 git remote -v update + /usr/bin/timeout -s INT 3600 git remote -v update -p + git remote set-head origin --auto git repack -a -b -d sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') sz=$(($sz*1024)) diff --git a/git.sh b/git.sh index 7c4fe2e..482279e 100755 --- a/git.sh +++ b/git.sh @@ -12,7 +12,8 @@ function repo_init() { function update_linux_git() { cd $TUNASYNC_WORKING_DIR echo "==== SYNC $UPSTREAM START ====" - /usr/bin/timeout -s INT 3600 git remote -v update + /usr/bin/timeout -s INT 3600 git remote -v update -p + git remote set-head origin --auto 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+') diff --git a/homebrew.sh b/homebrew.sh index 39c732d..995f248 100755 --- a/homebrew.sh +++ b/homebrew.sh @@ -9,7 +9,8 @@ function update_homebrew_git() { repo_dir="$1" cd $repo_dir 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 -p + git remote set-head origin --auto 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+') diff --git a/llvm.sh b/llvm.sh index 2288dd6..c6e5c2b 100755 --- a/llvm.sh +++ b/llvm.sh @@ -9,7 +9,8 @@ function repo_update() { repo_dir="$1" cd $repo_dir 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 -p + git remote set-head origin --auto 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+')