11#! /bin/bash
22#
3- # repoclone
4- # version 0.1
3+ # repoclone.sh
4+ # version 0.2
55#
66# Clones a local Android repo to another local Android repo, with native git clone object hardlinks to conserve storage.
77#
@@ -31,8 +31,10 @@ set -e
3131
3232# Copy directory structure without .git directories
3333echo " ### Copy directory structure without .git directories ###"
34- echo rsync -a -f" + */" -f" - *" $1 / $2 /
35- rsync -a -f" + */" -f" - *" $1 / $2 /
34+ echo mkdir $2 /
35+ echo rsync -a -f" + */" -f" - *" $1 /.repo/ $2 /.repo/
36+ mkdir $2 /
37+ rsync -a -f" + */" -f" - *" $1 /.repo/ $2 /.repo/
3638
3739# Copy .repo without pack/ directories
3840echo " ### Copy .repo without pack/ directories ###"
@@ -47,23 +49,16 @@ for packdir in $(find $1/.repo/ -type d -name pack); do
4749 cp -al $packdir $targetdir
4850done
4951
50- # List of .git directories
51- GITLIST=$( find $1 / -type d -name .git| grep -v \. repo)
52-
53- # Copy .git symlinks
54- echo " ### Copy .git symlinks ###"
55- for fromgit in $GITLIST ; do
56- togit=$( echo $fromgit | sed " s/^$1 /$2 /" )
57- echo rsync -a $fromgit / $togit /
58- rsync -a $fromgit / $togit /
59- done
60-
6152# Done
6253echo
6354echo " Done cloning $1 to $2 !"
6455echo
65- echo " Next run the following commands to checkout the source from the"
66- echo " repos to the working directories."
67- echo " cd $2 "
68- echo " gitreset.sh --yes"
56+ echo " Suggested Next Steps"
57+ echo " ===================="
58+ echo " cd $2 "
59+ echo " repo init -b ics"
60+ echo " # Switch to a different branch."
61+ echo " # You should first adjust your .repo/local_manifest.xml"
62+ echo " repo sync"
63+ echo " # Restore checkout of working directories from .repo"
6964echo
0 commit comments