Signed-off-by: Matt Darfeuille <[email protected]>
---
 build/release | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/build/release b/build/release
index 6dae6b0a..4f5c508f 100755
--- a/build/release
+++ b/build/release
@@ -112,30 +112,34 @@ check_working_tree() # $1 = path of repository
 
 checkout_branch_func()
 {
-    BRANCH_NAME=$CHECKOUT_BRANCH_NAME
+    if check_working_tree $1; then
+        BRANCH_NAME=$CHECKOUT_BRANCH_NAME
 
-    echo "Checking out branch ${BRANCH_NAME}in ${1}/.git..."
+        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 checkout --quiet $BRANCH_NAME
+        [ $? -ne 0 ] && fatal_error "Failed to check out branch ${BRANCH_NAME} 
in ${1}/.git."
+    fi
 }
 
 checkout_branch_auto_func()
 {
-    if git --git-dir=${1}/.git show-ref --quiet --verify -- 
"refs/heads/$BASEVERSION"; then
-        BRANCH_NAME=$BASEVERSION
+    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..."
+            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."
-    else
-        BRANCH_NAME=master
+            git --git-dir=${1}/.git checkout --quiet $BRANCH_NAME
+            [ $? -ne 0 ] && fatal_error "Failed to check out branch 
${BRANCH_NAME} in ${1}/.git."
+        else
+            BRANCH_NAME=master
 
-        echo "Checking out branch ${BRANCH_NAME}in ${1}/.git..."
+            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 checkout --quiet $BRANCH_NAME
+            [ $? -ne 0 ] && fatal_error "Failed to check out branch 
${BRANCH_NAME} in ${1}/.git."
+        fi
     fi
 }
 
-- 
2.14.1


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-devel

Reply via email to