2018-05-02 13:03:40 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
org="$1"
|
|
|
|
repo="$2"
|
2018-12-22 05:16:37 +03:00
|
|
|
defbranch="$3"
|
|
|
|
|
|
|
|
[ -z "$defbranch" ] && defbranch="develop"
|
2018-05-02 13:03:40 +03:00
|
|
|
|
2018-05-02 18:49:08 +03:00
|
|
|
rm -r "$repo" || true
|
|
|
|
|
2018-05-02 17:53:38 +03:00
|
|
|
curbranch="$TRAVIS_PULL_REQUEST_BRANCH"
|
|
|
|
[ -z "$curbranch" ] && curbranch="$TRAVIS_BRANCH"
|
2018-05-02 18:43:51 +03:00
|
|
|
[ -z "$curbranch" ] && curbranch=`"echo $GIT_BRANCH" | sed -e 's/^origin\///'` # jenkins
|
2018-05-02 13:03:40 +03:00
|
|
|
|
2018-05-02 17:53:38 +03:00
|
|
|
if [ -n "$curbranch" ]
|
|
|
|
then
|
|
|
|
echo "Determined branch to be $curbranch"
|
2018-05-02 13:03:40 +03:00
|
|
|
|
2018-05-02 17:53:38 +03:00
|
|
|
git clone https://github.com/$org/$repo.git $repo --branch "$curbranch" && exit 0
|
|
|
|
fi
|
|
|
|
|
2018-12-29 05:42:13 +03:00
|
|
|
echo "Checking out default branch $defbranch"
|
2018-12-22 05:16:37 +03:00
|
|
|
git clone https://github.com/$org/$repo.git $repo --branch $defbranch
|