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() {
27
27
fi
28
28
}
29
29
30
+ find_repositories () {
31
+ find " $1 " -name .git -exec dirname {} \;
32
+ }
33
+
30
34
optimize_sync () {
31
35
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_repositories $SYNC )
35
37
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
38
40
git gc
39
41
cd - || error " optimizing_sync: cd - (assert false)" || continue
40
42
done
41
- git gc
42
- cd ..
43
43
echo " optimizing done"
44
44
}
45
45
46
46
clone_sync () {
47
47
rm -rf ${BACKUP:? } /$SYNC
48
48
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 "
51
52
done
52
53
# copy directories which are not repositories yet
53
54
echo " cp -rn $SYNC $BACKUP /$SYNC "
You can’t perform that action at this time.
0 commit comments