get_snapshot: Add UPSTREAM_GIT_NOREPO to forbid any repo interaction

This commit is contained in:
Markus Frosch 2017-06-07 15:28:45 +02:00
parent df902f3daf
commit 445f7bdcfa

View File

@ -31,7 +31,8 @@ workdir=`pwd`
set -x
if [ -d "${PROJECT}.git/" ]; then
if [ -z "$UPSTREAM_GIT_NOREPO" ]; then
if [ -d "${PROJECT}.git/" ]; then
cd "${PROJECT}.git"
if [ ! -d .git ]; then
echo "This is not a GIT repository: $(pwd)" >&2
@ -46,12 +47,13 @@ if [ -d "${PROJECT}.git/" ]; then
git reset --hard "origin/${UPSTREAM_GIT_BRANCH}"
fi
git clean -fdx
elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then
git clone -b "${UPSTREAM_GIT_BRANCH}" "${UPSTREAM_GIT_URL}" "${PROJECT}.git/"
cd "${PROJECT}.git"
else
else
echo "Missing '${PROJECT}.git' directory!" >&2
exit 1
fi
fi
git_version=$(git describe --tags "${UPSTREAM_GIT_BRANCH}")