use variable names for git_clone function

This commit is contained in:
Jesse Andrews 2011-10-24 18:47:06 -07:00
parent eeec020628
commit 917c66584f

View file

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