Signed-off-by: Matt Darfeuille <matd...@gmail.com>
---
 build/release | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

diff --git a/build/release b/build/release
index 85e7aef3..9ac63502 100755
--- a/build/release
+++ b/build/release
@@ -111,35 +111,19 @@ check_working_tree() # $1 = path of repository
     fi
 }
 
-checkout_branch_func()
+checkout_branch_func() # $1 = Path of repository, $2 = branch name
 {
     if check_working_tree $1; then
-        BRANCH_NAME=$CHECKOUT_BRANCH_NAME
+        if git --git-dir=${1}/.git show-ref --quiet --verify -- 
"refs/heads/${2}"; then
+            echo "Checking out branch ${2} in ${1}/.git..."
 
-        echo "Checking out branch ${BRANCH_NAME}in ${1}/.git..."
-
-        git --git-dir=${1}/.git --work-tree=${1} checkout --quiet $BRANCH_NAME
-        [ $? -ne 0 ] && fatal_error "Failed to check out branch ${BRANCH_NAME} 
in ${1}/.git."
-    fi
-}
-
-checkout_branch_auto_func()
-{
-    if check_working_tree $1; then
-        if git --git-dir=${1}/.git show-ref --quiet --verify -- 
"refs/heads/$BASEVERSION"; then
-            BRANCH_NAME=$BASEVERSION
-
-            echo "Checking out branch ${BRANCH_NAME}in ${1}/.git..."
-
-            git --git-dir=${1}/.git checkout --quiet $BRANCH_NAME
-            [ $? -ne 0 ] && fatal_error "Failed to check out branch 
${BRANCH_NAME} in ${1}/.git."
+            git --git-dir=${1}/.git --work-tree=${1} checkout --quiet $2
+            [ $? -ne 0 ] && fatal_error "Failed to check out branch ${2} in 
${1}/.git."
         else
-            BRANCH_NAME=master
-
-            echo "Checking out branch ${BRANCH_NAME}in ${1}/.git..."
+            echo "Checking out branch master in ${1}/.git..."
 
-            git --git-dir=${1}/.git checkout --quiet $BRANCH_NAME
-            [ $? -ne 0 ] && fatal_error "Failed to check out branch 
${BRANCH_NAME} in ${1}/.git."
+            git --git-dir=${1}/.git --work-tree=${1} checkout --quiet master
+            [ $? -ne 0 ] && fatal_error "Failed to check out branch master in 
${1}/.git."
         fi
     fi
 }
@@ -300,11 +284,11 @@ case $VERSION in
 esac
 
 if [ -n "$CHECKOUT_BRANCH_AUTO" -o -z "$CHECKOUT_BRANCH_AUTO" -a -z 
"$CHECKOUT_BRANCH_NAME" ]; then
-    checkout_branch_auto_func $GIT
-    checkout_branch_auto_func $GITRELEASEDIR
+    checkout_branch_func $GIT $BASEVERSION
+    checkout_branch_func $GITRELEASEDIR $BASEVERSION
 elif [ -n "$CHECKOUT_BRANCH_NAME" ]; then
-    checkout_branch_func $GIT
-    checkout_branch_func $GITRELEASEDIR
+    checkout_branch_func $GIT $CHECKOUT_BRANCH_NAME
+    checkout_branch_func $GITRELEASEDIR $CHECKOUT_BRANCH_NAME
 fi
 
 if [ -z "$GIT_CODE_OBJECT" -a -z "$GIT_RELEASE_OBJECT" ]; then
-- 
2.17.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Shorewall-devel mailing list
Shorewall-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/shorewall-devel

Reply via email to