mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-18 19:22:44 +00:00
avoid repacking every time
This commit is contained in:
parent
00c168ce17
commit
7616d97e4c
6
aosp.sh
6
aosp.sh
@ -5,6 +5,9 @@ REPO=${REPO:-"/usr/local/bin/repo"}
|
||||
USE_BITMAP_INDEX=${USE_BITMAP_INDEX:-"0"}
|
||||
UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://android.googlesource.com/mirror/manifest"}
|
||||
|
||||
git config --global user.email "mirrors@tuna"
|
||||
git config --global user.name "tuna mirrors"
|
||||
|
||||
function repo_init() {
|
||||
mkdir -p $TUNASYNC_WORKING_DIR
|
||||
cd $TUNASYNC_WORKING_DIR
|
||||
@ -22,7 +25,8 @@ function git_repack() {
|
||||
cd $repo
|
||||
size=$(du -sk .|cut -f1)
|
||||
total_size=$(($total_size+1024*$size))
|
||||
if [[ "$size" -gt "100000" ]]; then
|
||||
objs=$(find objects -type f | wc -l)
|
||||
if [[ "$objs" -gt 8 && "$size" -gt "100000" ]]; then
|
||||
git repack -a -b -d
|
||||
fi
|
||||
done < <(find $TUNASYNC_WORKING_DIR -type d -not -path "*/.repo/*" -name "*.git")
|
||||
|
3
cros.sh
3
cros.sh
@ -41,7 +41,8 @@ function git_repack() {
|
||||
cd $repo
|
||||
size=$(du -sk .|cut -f1)
|
||||
total_size=$(($total_size+1024*$size))
|
||||
if [[ "$size" -gt "100000" ]]; then
|
||||
objs=$(find objects -type f | wc -l)
|
||||
if [[ "$objs" -gt 8 && "$size" -gt "100000" ]]; then
|
||||
git repack -a -b -d
|
||||
fi
|
||||
done < <(find $TUNASYNC_WORKING_DIR -not -path "$MANIFEST_DIR/.git/*" -type f -name HEAD -exec dirname '{}' ';')
|
||||
|
3
git.sh
3
git.sh
@ -13,7 +13,8 @@ function update_linux_git() {
|
||||
cd $TUNASYNC_WORKING_DIR
|
||||
echo "==== SYNC $UPSTREAM START ===="
|
||||
/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=$(($sz*1024))
|
||||
echo "size-pack:" $(numfmt --to=iec $sz)
|
||||
|
@ -10,7 +10,8 @@ function update_homebrew_git() {
|
||||
cd $repo_dir
|
||||
echo "==== SYNC $repo_dir START ===="
|
||||
/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+')
|
||||
total_size=$(($total_size+1024*$sz))
|
||||
echo "==== SYNC $repo_dir DONE ===="
|
||||
|
3
llvm.sh
3
llvm.sh
@ -10,7 +10,8 @@ function repo_update() {
|
||||
cd $repo_dir
|
||||
echo "==== SYNC $repo_dir START ===="
|
||||
/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+')
|
||||
total_size=$(($total_size+1024*$sz))
|
||||
echo "==== SYNC $repo_dir DONE ===="
|
||||
|
Loading…
x
Reference in New Issue
Block a user