]> xenbits.xen.org Git - xenclient/build.git/commitdiff
[scripts] Change the git_checkout script so it understands tag and branches now.
authorJean Guyader <jean.guyader@eu.citrix.com>
Fri, 6 Nov 2009 15:32:54 +0000 (15:32 +0000)
committerJean Guyader <jean.guyader@eu.citrix.com>
Fri, 6 Nov 2009 15:32:54 +0000 (15:32 +0000)
scripts/git_checkout.sh

index 01377f80166af891c34f89030ac994fcb27d30af..9da8a62888706a311408b4ac1da27c1445ce5a3d 100755 (executable)
@@ -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
 }