turn off f24 build
[infrastructure.git] / scripts / git-update.sh
index 93b8ffd..dc04653 100755 (executable)
@@ -20,6 +20,15 @@ fi
 ##########
 cd $DIRNAME
 
+### xxx ideally we should not need to git checkout anything
+# which would in addition remove the need for a non-bare repo
+# this would take a bit more time though
+
+# make sure we keep track of the current branch upon exit
+function current_branch () {
+    git branch | grep '^\*' | cut -d' ' -f2
+}
+
 function all_branches () {
     remote=$1; shift
     git branch -r | grep $remote | fgrep -v -- '->' | sed "s/.*\///g"
@@ -27,6 +36,7 @@ function all_branches () {
     
 
 function git_update () {
+    current_branch=$(current_branch)
     echo Running $COMMAND
     remote=origin
     for branch in $(all_branches $remote); do
@@ -35,6 +45,7 @@ function git_update () {
        git checkout $branch
        git merge --ff $remote/$branch
     done
+    git checkout $current_branch
 }
 
 git_update >& .git-update.log