Properly refresh branches.

Just calling `git reset --hard` on a branch name doesn't pull in
upstream changes.
This commit is contained in:
Roberto Aguilar 2013-03-08 11:18:14 -08:00
parent 60ad2dc9af
commit 6897ae92d5

View file

@ -730,7 +730,17 @@ __git_clone_and_checkout() {
if [ -d $SALT_GIT_CHECKOUT_DIR ]; then
cd $SALT_GIT_CHECKOUT_DIR
git fetch
git reset --hard $GIT_REV
git checkout $GIT_REV
# Just calling `git reset --hard $GIT_REV` on a branch name that has
# already been checked out will not update that branch to the upstream
# HEAD; instead it will simply reset to itself. Check the ref to see
# if it is a branch name, check out the branch, and pull in the
# changes.
git branch -a | grep -q ${GIT_REV}
if [ "$?" == "0" ]; then
git pull --rebase
fi;
else
git clone https://github.com/saltstack/salt.git salt
cd $SALT_GIT_CHECKOUT_DIR