fix: use whitespaces instead of tabs
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Markus Pesch 2023-10-01 20:44:02 +02:00
parent 8e901429a3
commit 9fae1f4211
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 63 additions and 63 deletions

View File

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
set -e
set -x set -x
FLAGS="" GIT_FETCH_ARGS=""
GIT_CHECKOUT_ARGS=""
if [[ -n "${PLUGIN_DEPTH}" ]]; then if [[ -n "${PLUGIN_DEPTH}" ]]; then
FLAGS="--depth=${PLUGIN_DEPTH}" GIT_FETCH_ARGS="${GIT_FETCH_ARGS} --depth=${PLUGIN_DEPTH}"
fi fi
if [ ! -d .git ]; then if [ ! -d .git ]; then
@ -18,28 +21,25 @@ fi
# we intentially omit depth flags to avoid failed # we intentially omit depth flags to avoid failed
# clones due to lack of history. # clones due to lack of history.
if [[ -z "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then if [[ -z "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
set -e GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} --quiet --force ${DRONE_COMMIT_SHA}"
set -x GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin"
git fetch origin
git checkout --quiet --force "${DRONE_COMMIT_SHA}"
exit 0
fi fi
# the commit sha may be empty for builds that are # the commit sha may be empty for builds that are
# manually triggered in Harness CI Enterprise. If # manually triggered in Harness CI Enterprise. If
# the commit is empty we clone the branch. # the commit is empty we clone the branch.
if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -z "${DRONE_COMMIT_SHA}" ]]; then if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -z "${DRONE_COMMIT_SHA}" ]]; then
set -e GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${DRONE_COMMIT_BRANCH} refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
set -x GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git checkout -b "${DRONE_COMMIT_BRANCH}" "refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
exit 0
fi fi
# if the commit sha and branch name not empty, fetch the branch even if a # if the commit sha and branch name not empty, fetch the branch even if a
# fast-forward is not possible. Checkout the specified commit sha which must be # fast-forward is not possible. Checkout the specified commit sha which must be
# part of the branch. # part of the branch.
set -e if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
set -x GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${DRONE_COMMIT_SHA} -b refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}" GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
git checkout "${DRONE_COMMIT_SHA}" -b "refs/remotes/origin/${DRONE_COMMIT_BRANCH}" fi
git fetch ${GIT_FETCH_ARGS}
git checkout ${GIT_CHECKOUT_ARGS}

View File

@ -13,7 +13,7 @@ fi
set -e set -e
set -x set -x
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:" git fetch ${FLAGS} origin "+refs/heads/${DRONE_COMMIT_BRANCH}:"
git checkout "${DRONE_COMMIT_BRANCH}" git checkout "${DRONE_COMMIT_BRANCH}"
git fetch origin "${DRONE_COMMIT_REF}:" git fetch origin "${DRONE_COMMIT_REF}:"

View File

@ -13,5 +13,5 @@ fi
set -e set -e
set -x set -x
git fetch "${FLAGS}" origin "+refs/tags/${DRONE_TAG}:" git fetch ${FLAGS} origin "+refs/tags/${DRONE_TAG}:"
git checkout --quiet --force FETCH_HEAD git checkout --quiet --force FETCH_HEAD