From a4543cb1c2e90dcdb59031d9128c2e887294dbc4 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 7 Jun 2017 14:52:17 +0200 Subject: [PATCH] get_snapshot: Support UPSTREAM_GIT_NOUPDATE And do not manage git when set! --- get_snapshot | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/get_snapshot b/get_snapshot index 7b3acb9..693becd 100755 --- a/get_snapshot +++ b/get_snapshot @@ -37,16 +37,21 @@ if [ -d "${PROJECT}.git/" ]; then echo "This is not a GIT repository: $(pwd)" >&2 exit 1 fi - if [ "$(git config remote.origin.url)" != "${UPSTREAM_GIT_URL}" ]; then - git remote set-url origin "${UPSTREAM_GIT_URL}" + if [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then + if [ "$(git config remote.origin.url)" != "${UPSTREAM_GIT_URL}" ]; then + git remote set-url origin "${UPSTREAM_GIT_URL}" + fi + git fetch origin -p + git checkout -f "${UPSTREAM_GIT_BRANCH}" + git reset --hard "origin/${UPSTREAM_GIT_BRANCH}" fi - git fetch origin -p - git checkout -f "${UPSTREAM_GIT_BRANCH}" - git reset --hard "origin/${UPSTREAM_GIT_BRANCH}" git clean -fdx -else +elif [ -z "$UPSTREAM_GIT_NOUPDATE" ]; then git clone -b "${UPSTREAM_GIT_BRANCH}" "${UPSTREAM_GIT_URL}" "${PROJECT}.git/" cd "${PROJECT}.git" +else + echo "Missing '${PROJECT}.git' directory!" >&2 + exit 1 fi git_version=$(git describe --tags HEAD)