File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343
4444git clean -ffxdq
4545
46- # fetch branch if commit is HEAD, respecting BUILDKITE_GIT_FETCH_FLAGS if set
47- FETCH_FLAGS=" ${BUILDKITE_GIT_FETCH_FLAGS:- } "
46+ FETCH_FLAGS=()
47+ if [[ -n " ${BUILDKITE_GIT_FETCH_FLAGS:- } " ]]; then
48+ # Use read -a to split the flags safely and shellcheck-compliantly
49+ read -r -a FETCH_FLAGS <<< " ${BUILDKITE_GIT_FETCH_FLAGS}"
50+ fi
51+
52+ FETCH_FLAGS+=(--depth 1 origin)
53+
4854if [[ ${BUILDKITE_COMMIT} = " HEAD" ]]; then
49- git fetch --depth 1 " ${ FETCH_FLAGS} " origin " ${BUILDKITE_BRANCH} "
55+ FETCH_FLAGS+=( " ${BUILDKITE_BRANCH} " )
5056else
51- git fetch --depth 1 " ${ FETCH_FLAGS} " origin " ${BUILDKITE_COMMIT} "
57+ FETCH_FLAGS+=( " ${BUILDKITE_COMMIT} " )
5258fi
5359
60+ git fetch " ${FETCH_FLAGS[@]} "
61+
5462git sparse-checkout set ${NO_CONE_PARAM: +--no-cone} " ${CHECKOUT_PATHS[@]} "
5563if [[ ${BUILDKITE_COMMIT} = " HEAD" ]]; then
5664 git checkout FETCH_HEAD
You can’t perform that action at this time.
0 commit comments