From 41df966396416907011a66596d519d7d5e1caf1c Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 8 Feb 2017 16:55:55 +0100 Subject: [PATCH] icinga2/icingaweb2: Update get_snapshot to support branch/url changes --- get_snapshot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/get_snapshot b/get_snapshot index 64c40bf..c6fb63c 100755 --- a/get_snapshot +++ b/get_snapshot @@ -37,7 +37,11 @@ if [ -d "${PROJECT}.git/" ]; then echo "This is not a GIT repository: $(pwd)" >&2 exit 1 fi - git fetch origin -p + 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}" git clean -fdx else