From 440df370dc93f49782631aa8db02c3e659eeec98 Mon Sep 17 00:00:00 2001 From: Roberto Aguilar Date: Fri, 1 Mar 2013 00:05:57 -0800 Subject: [PATCH] Added fetch & reset to refresh existing repo. When bootstrap is run more than once on a machine, the existing git checkout is now refreshed instead of just used as is. --- bootstrap-salt.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 94faf13..fe0b58b 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -722,9 +722,16 @@ __git_clone_and_checkout() { SALT_GIT_CHECKOUT_DIR=/tmp/git/salt [ -d /tmp/git ] || mkdir /tmp/git cd /tmp/git - [ -d $SALT_GIT_CHECKOUT_DIR ] || git clone git://github.com/saltstack/salt.git salt - cd salt - git checkout $GIT_REV + if [ -d $SALT_GIT_CHECKOUT_DIR ]; then + cd $SALT_GIT_CHECKOUT_DIR + + git fetch + git reset --hard origin/$GIT_REV + else + git clone git://github.com/saltstack/salt.git salt + cd $SALT_GIT_CHECKOUT_DIR + git checkout $GIT_REV + fi }