From 1dc003e4ddd67b9b10220e08dae6bdf78969e169 Mon Sep 17 00:00:00 2001 From: EYJ Date: Tue, 22 Sep 2015 14:37:24 +0200 Subject: [PATCH] Do not fetch saltstack repo if shallow-cloning from a non-saltstack repo --- bootstrap-salt.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 34dd584..ccc511f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1322,18 +1322,16 @@ __git_clone_and_checkout() { if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then git clone "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME" || return 1 cd "${__SALT_GIT_CHECKOUT_DIR}" - fi - if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; then - # We need to add the saltstack repository as a remote and fetch tags for proper versioning - echoinfo "Adding SaltStack's Salt repository as a remote" - git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 - echodebug "Fetching upstream(SaltStack's Salt repository) git tags" - git fetch --tags upstream || return 1 - GIT_REV="origin/$GIT_REV" - fi + if [ "$(echo "$_SALT_REPO_URL" | grep -c -e '\(\(git\|https\)://github\.com/\|git@github\.com:\)saltstack/salt\.git')" -eq 0 ]; then + # We need to add the saltstack repository as a remote and fetch tags for proper versioning + echoinfo "Adding SaltStack's Salt repository as a remote" + git remote add upstream "$_SALTSTACK_REPO_URL" || return 1 + echodebug "Fetching upstream(SaltStack's Salt repository) git tags" + git fetch --tags upstream || return 1 + GIT_REV="origin/$GIT_REV" + fi - if [ "$__SHALLOW_CLONE" -eq "${BS_FALSE}" ]; then echodebug "Checking out $GIT_REV" git checkout "$GIT_REV" || return 1 fi