From: Bill Erickson Date: Mon, 26 Jan 2015 20:52:32 +0000 (-0800) Subject: JBAS-415 eg-updator avoids extra git server lookup X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c376f7bec037241061e5d5313c5d8381d0d8afc2;p=working%2FEvergreen.git JBAS-415 eg-updator avoids extra git server lookup Only call git fetch or pull once, so the user won't be prompted for multiple SSH key logins when using keys/passwords. Signed-off-by: Bill Erickson --- diff --git a/KCLS/misc-scripts/eg-updater.sh b/KCLS/misc-scripts/eg-updater.sh index 64accc55df..4408ffaf6f 100755 --- a/KCLS/misc-scripts/eg-updater.sh +++ b/KCLS/misc-scripts/eg-updater.sh @@ -181,18 +181,21 @@ function checkout_code { function fetch_code { - # update local refs - $GIT fetch $GIT_REMOTE > /dev/null - if [ -n "$GIT_PULL" ]; then + # 'git fetch' is unnecessary when pulling, plus it causes + # an extra password prompt when using SSH keys w/ passwords announce "Pulling updates for $($GIT rev-parse --abbrev-ref HEAD)"; $GIT pull > /dev/null elif [ -n "$GIT_TAG" ]; then + announce "Fetching Git remote $GIT_REMOTE" + $GIT fetch $GIT_REMOTE > /dev/null announce "Checking out tag $GIT_TAG" checkout_code "$GIT_TAG" "$GIT_TAG" elif [ -n "$GIT_BRANCH" ]; then + announce "Fetching Git remote $GIT_REMOTE" + $GIT fetch $GIT_REMOTE > /dev/null announce "Checking out branch $GIT_BRANCH" checkout_code "$GIT_BRANCH" "$GIT_REMOTE/$GIT_BRANCH"