From: Jean Guyader Date: Fri, 6 Nov 2009 15:32:54 +0000 (+0000) Subject: [scripts] Change the git_checkout script so it understands tag and branches now. X-Git-Url: http://xenbits.xen.org/gitweb?a=commitdiff_plain;h=042939ba0c1651ed0c454de573a38263ce18bafc;p=xenclient%2Fbuild.git [scripts] Change the git_checkout script so it understands tag and branches now. --- diff --git a/scripts/git_checkout.sh b/scripts/git_checkout.sh index 01377f8..9da8a62 100755 --- a/scripts/git_checkout.sh +++ b/scripts/git_checkout.sh @@ -34,14 +34,16 @@ git_checkout() { local componant="$1" local path="$repo/$componant" + local remote_branch="" [ ! -r "manifest" ] && echo "master" && return checkout=`git_get_branch_name "$componant"` - - echo "Try to switch to the branch $checkout." set +e - ( cd "$path" && git checkout -b "$checkout" "origin/$checkout" 2>/dev/null) + echo "Try to switch to the branch $checkout." + remote_branch=`git branch -a | grep -E "$branch$"` + [ "$?" -ne 0 ] && remote_branch="$branch" + ( cd "$path" && git checkout -b "$branch" $remote_branch ) set -e }