From dd96a5a670fff3410e43a210fe98b63a12b35eee Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Thu, 29 Oct 2020 16:07:40 +0530 Subject: [PATCH] Support cloning a branch without commit --- posix/clone-commit | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/posix/clone-commit b/posix/clone-commit index 358ecaf..00405e4 100755 --- a/posix/clone-commit +++ b/posix/clone-commit @@ -23,6 +23,14 @@ if [[ -z "${DRONE_COMMIT_BRANCH}" ]]; then exit 0 fi +if [[ -z "${DRONE_COMMIT_SHA}" ]]; then + set -e + set -x + git fetch ${FLAGS} origin +refs/heads/${DRONE_COMMIT_BRANCH}: + git checkout -b ${DRONE_COMMIT_BRANCH} + exit 0 +fi + set -e set -x