Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.
Permalink
next
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 43 lines (34 sloc) 1.01 KB
#!/bin/sh
# pull request ref
REF="pull/${DRONE_PULL_REQUEST}/head"
# pull request ref, bitbucket
# case being used because pattern matching in /bin/sh needs to use case.
case "$DRONE_REMOTE_URL" in
"https://bitbucket.org/"*) REF="refs/pull-requests/${DRONE_PULL_REQUEST}/from" ;;
*) ;;
esac
# pull request ref, gitlab
# case being used because pattern matching in /bin/sh needs to use case.
case "$DRONE_COMMIT_REF" in
"refs/merge-requests/"*) REF="refs/merge-requests/${DRONE_PULL_REQUEST}/head" ;;
*) ;;
esac
FLAGS=""
if [[ ! -z "${PLUGIN_DEPTH}" ]]; then
FLAGS="--depth=${PLUGIN_DEPTH}"
fi
if [ ! -d .git ]; then
git init
git remote add origin ${DRONE_REMOTE_URL}
fi
set -e
set -x
git fetch ${FLAGS} origin +refs/heads/${DRONE_BRANCH}:
git checkout ${DRONE_BRANCH}
git fetch origin ${REF}:
git rebase ${DRONE_COMMIT}
# git clone ${FLAGS} -b ${DRONE_BRANCH} --single-branch ${DRONE_REMOTE_URL} \
# ${DRONE_WORKSPACE}
#
# git fetch origin pull/${DRONE_PULL_REQUEST}/head:
# git rebase ${DRONE_COMMIT}