File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 1+ env.list
Original file line number Diff line number Diff line change @@ -27,27 +27,28 @@ download_repository() {
2727 fi
2828}
2929
30+ find_repositories () {
31+ find " $1 " -name .git -exec dirname {} \;
32+ }
33+
3034optimize_sync () {
3135 echo " optimizing using git gc"
32- cd " $SYNC " || error " optimizing_sync: cd $SYNC " || return
33- DIRS=$( find . -mindepth 4 -maxdepth 4 -type d -not -path " \./\.git*" )
34- for i in $DIRS
36+ for repo in $( find_repsositories $SYNC )
3537 do
36- echo " $i "
37- cd " $i " || error " optimizing_sync: cd $i " || continue
38+ echo " optimizing $repo "
39+ cd " $repo " || error " optimizing_sync: cd $repo " || continue
3840 git gc
3941 cd - || error " optimizing_sync: cd - (assert false)" || continue
4042 done
41- git gc
42- cd ..
4343 echo " optimizing done"
4444}
4545
4646clone_sync () {
4747 rm -rf ${BACKUP:? } /$SYNC
4848 echo " cloning sync to avoid concurrency when writing"
49- find $SYNC -name .git | while read -r repository; do
50- git clone " $repository " $BACKUP /" $repository "
49+ for repo in $( find_repositories $SYNC )
50+ do
51+ git clone " $repo " $BACKUP /" $repo "
5152 done
5253 # copy directories which are not repositories yet
5354 echo " cp -rn $SYNC $BACKUP /$SYNC "
You can’t perform that action at this time.
0 commit comments