From: Holger Levsen Date: Fri, 23 Aug 2013 09:54:11 +0000 (+0200) Subject: maven_pre_helper: properly reset master branch. refactor a bit. X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=71196a79b1a178f575cc9cfeaa3a0dd28712ee0c;p=profitbricks%2Fjenkins-build-scripts.git maven_pre_helper: properly reset master branch. refactor a bit. --- diff --git a/maven_pre_build_debian_wrapper.sh b/maven_pre_build_debian_wrapper.sh index 9e9b603..0dd5646 100755 --- a/maven_pre_build_debian_wrapper.sh +++ b/maven_pre_build_debian_wrapper.sh @@ -23,9 +23,14 @@ if [[ "$BUILD_TRIGGERS" == *"no-test"* ]]; then fi export +echo "Fetching from remote..." +git fetch origin --prune echo "About to build branch:" figlet "$GIT_BRANCH_NAME" git checkout $GIT_BRANCH_NAME +echo "Resetting $GIT_BRANCH_NAME branch to remote state..." +git reset --hard refs/remotes/origin/$GIT_BRANCH_NAME +echo git status if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then @@ -36,8 +41,6 @@ if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bug # echo "Switching to integration branch..." git checkout integration - echo "Fetching from remote..." - git fetch origin --prune echo "Resetting integration branch to remote state..." git reset --hard refs/remotes/origin/integration figlet "integration merge" @@ -51,10 +54,5 @@ elif [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfi TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',') git tag $TAG -m "Testing whether there is already a tag $TAG..." git tag -d $TAG -elif [[ "$GIT_BRANCH_NAME" = "integration" ]] ; then - echo "Fetching from remote..." - git fetch origin --prune - echo "Resetting integration branch to remote state..." - git reset --hard refs/remotes/origin/integration fi