[git scripts] add --prune, update remotes/origin/HEAD

This commit is contained in:
z4yx 2020-04-27 13:16:44 +08:00
parent 2da266497b
commit 633c7116dc
6 changed files with 12 additions and 6 deletions

View File

@ -13,7 +13,8 @@ function update_font_git() {
repo_dir="$1" repo_dir="$1"
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 -p
git remote set-head origin --auto
objs=$(find objects -type f | wc -l) objs=$(find 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+')

View File

@ -11,7 +11,8 @@ function update_cocoapods_git() {
repo_dir="$1" repo_dir="$1"
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 -p
git remote set-head origin --auto
objs=$(find objects -type f | wc -l) objs=$(find 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+')

View File

@ -8,7 +8,8 @@ function repo_init() {
function update_repo_git() { function update_repo_git() {
cd $TUNASYNC_WORKING_DIR cd $TUNASYNC_WORKING_DIR
echo "==== SYNC repo.git START ====" 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 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+')
sz=$(($sz*1024)) sz=$(($sz*1024))

3
git.sh
View File

@ -12,7 +12,8 @@ function repo_init() {
function update_linux_git() { function update_linux_git() {
cd $TUNASYNC_WORKING_DIR cd $TUNASYNC_WORKING_DIR
echo "==== SYNC $UPSTREAM START ====" 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=$(find 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+')

View File

@ -9,7 +9,8 @@ function update_homebrew_git() {
repo_dir="$1" repo_dir="$1"
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 -p
git remote set-head origin --auto
objs=$(find objects/ -type f | wc -l) objs=$(find 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+')

View File

@ -9,7 +9,8 @@ function repo_update() {
repo_dir="$1" repo_dir="$1"
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 -p
git remote set-head origin --auto
objs=$(find objects/ -type f | wc -l) objs=$(find 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+')