| ... | ... |
@@ -303,26 +303,31 @@ sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*` |
| 303 | 303 |
# ownership to the proper user. |
| 304 | 304 |
function git_clone {
|
| 305 | 305 |
|
| 306 |
+ GIT_REMOTE=$1 |
|
| 307 |
+ GIT_DEST=$2 |
|
| 308 |
+ GIT_BRANCH=$3 |
|
| 309 |
+ |
|
| 306 | 310 |
# do a full clone only if the directory doesn't exist |
| 307 |
- if [ ! -d $2 ]; then |
|
| 308 |
- git clone $1 $2 |
|
| 311 |
+ if [ ! -d $GIT_DEST ]; then |
|
| 312 |
+ git clone $GIT_REMOTE $GIT_DEST |
|
| 309 | 313 |
cd $2 |
| 310 | 314 |
# This checkout syntax works for both branches and tags |
| 311 |
- git checkout $3 |
|
| 315 |
+ git checkout $GIT_BRANCH |
|
| 312 | 316 |
elif [[ "$RECLONE" == "yes" ]]; then |
| 313 | 317 |
# if it does exist then simulate what clone does if asked to RECLONE |
| 314 |
- cd $2 |
|
| 318 |
+ cd $GIT_BRANCH |
|
| 315 | 319 |
# set the url to pull from and fetch |
| 316 |
- git remote set-url origin $1 |
|
| 320 |
+ git remote set-url origin $GIT_REMOTE |
|
| 317 | 321 |
git fetch origin |
| 318 | 322 |
# if we don't delete the local content, then our system has pyc files |
| 319 | 323 |
# from the previous branch leading to breakage (due to the py files |
| 320 | 324 |
# having older timestamps than our pyc, so python thinks the pyc files |
| 321 | 325 |
# are correct using them) |
| 322 | 326 |
rm -rf * |
| 323 |
- git checkout -f origin/$3 |
|
| 324 |
- git branch -D $3 |
|
| 325 |
- git checkout -b $3 |
|
| 327 |
+ git checkout -f origin/$GIT_BRANCH |
|
| 328 |
+ # a local branch might not exist for $3 |
|
| 329 |
+ git branch -D $GIT_BRANCH || true |
|
| 330 |
+ git checkout -b $GIT_BRANCH |
|
| 326 | 331 |
fi |
| 327 | 332 |
} |
| 328 | 333 |
|