fix: use whitespaces instead of tabs
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
8e901429a3
commit
9fae1f4211
@ -1,10 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
FLAGS=""
|
||||
GIT_FETCH_ARGS=""
|
||||
GIT_CHECKOUT_ARGS=""
|
||||
|
||||
if [[ -n "${PLUGIN_DEPTH}" ]]; then
|
||||
FLAGS="--depth=${PLUGIN_DEPTH}"
|
||||
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} --depth=${PLUGIN_DEPTH}"
|
||||
fi
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
@ -18,28 +21,25 @@ fi
|
||||
# we intentially omit depth flags to avoid failed
|
||||
# clones due to lack of history.
|
||||
if [[ -z "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
|
||||
set -e
|
||||
set -x
|
||||
git fetch origin
|
||||
git checkout --quiet --force "${DRONE_COMMIT_SHA}"
|
||||
exit 0
|
||||
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} --quiet --force ${DRONE_COMMIT_SHA}"
|
||||
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin"
|
||||
fi
|
||||
|
||||
# the commit sha may be empty for builds that are
|
||||
# manually triggered in Harness CI Enterprise. If
|
||||
# the commit is empty we clone the branch.
|
||||
if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -z "${DRONE_COMMIT_SHA}" ]]; then
|
||||
set -e
|
||||
set -x
|
||||
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
|
||||
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${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}"
|
||||
fi
|
||||
|
||||
# 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
|
||||
# part of the branch.
|
||||
set -e
|
||||
set -x
|
||||
git fetch "${FLAGS}" origin "+refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
|
||||
git checkout "${DRONE_COMMIT_SHA}" -b "refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
|
||||
if [[ -n "${DRONE_COMMIT_BRANCH}" ]] && [[ -n "${DRONE_COMMIT_SHA}" ]]; then
|
||||
GIT_CHECKOUT_ARGS="${GIT_CHECKOUT_ARGS} -b ${DRONE_COMMIT_SHA} -b refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
|
||||
GIT_FETCH_ARGS="${GIT_FETCH_ARGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}:refs/remotes/origin/${DRONE_COMMIT_BRANCH}"
|
||||
fi
|
||||
|
||||
git fetch ${GIT_FETCH_ARGS}
|
||||
git checkout ${GIT_CHECKOUT_ARGS}
|
||||
|
@ -13,7 +13,7 @@ fi
|
||||
set -e
|
||||
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 fetch origin "${DRONE_COMMIT_REF}:"
|
||||
|
@ -13,5 +13,5 @@ fi
|
||||
set -e
|
||||
set -x
|
||||
|
||||
git fetch "${FLAGS}" origin "+refs/tags/${DRONE_TAG}:"
|
||||
git fetch ${FLAGS} origin "+refs/tags/${DRONE_TAG}:"
|
||||
git checkout --quiet --force FETCH_HEAD
|
||||
|
Loading…
Reference in New Issue
Block a user