From 4148c5c8861bf92e3c12c61e2906faf54cd895a1 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 29 Oct 2020 10:27:49 -0400 Subject: [PATCH] allow depth when cloning head commit in branch --- posix/clone-commit | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/posix/clone-commit b/posix/clone-commit index 023ed70..1dedc41 100755 --- a/posix/clone-commit +++ b/posix/clone-commit @@ -25,13 +25,11 @@ 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. Note that -# we intentially omit depth flags to avoid failed -# clones due to lack of history. +# the commit is empty we clone the branch. if [[ -z "${DRONE_COMMIT_SHA}" ]]; then set -e set -x - git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}: + git fetch ${FLAGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}: git checkout -b ${DRONE_COMMIT_BRANCH} origin/${DRONE_COMMIT_BRANCH} exit 0 fi