{
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
}