From a3e26d8a3540b7b12bc71a613be31dde7deb643a Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Mon, 12 Dec 2016 18:09:08 -0800 Subject: [PATCH] Improve clr-bundles branch updates With the current workflow, the "mix-bundles" repo is used for mix-specific bundle changes, and the "clr-bundles" repo is treated as read-only. So in clr-bundles, the CLRVER_mix branches should always point to the commit tagged with CLRVER. To make this handling more robust, first verify that CLRVER exists and is a tag. Then create the CLRVER_mix branch based on CLRVER, or if the branch already exists, reset it appropriately. Since this is the best place to detect invalid CLEAR_VERSION numbers passed in the builder.conf, I've added that error handling too. Signed-off-by: Patrick McCarty --- helpers | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/helpers b/helpers index 04beaf0..87f86b7 100644 --- a/helpers +++ b/helpers @@ -55,15 +55,14 @@ update_repo() { git pull origin master fi set +e - # checkout the tag relating to the clear version used to build against - git checkout tags/"$CLRVER" - local branch="${CLRVER}_mix" - git rev-parse --verify "$branch" + # Ensure that CLRVER exists and is a tag + git rev-parse --verify "${CLRVER}^{tag}" &> /dev/null if [ $? -eq 0 ]; then - git checkout "$branch" - git pull - else - git checkout -b "$branch" + # Always reset the _mix branch to be based off the tag + git checkout -B "${CLRVER}_mix" "${CLRVER}" + else + echo "ERROR: invalid CLEAR_VERSION in builder.conf (${CLRVER})" + exit 1 fi set -e cd ..