From c376f7bec037241061e5d5313c5d8381d0d8afc2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 26 Jan 2015 12:52:32 -0800 Subject: [PATCH] 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 --- KCLS/misc-scripts/eg-updater.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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" -- 2.11.0