build on f29
[infrastructure.git] / scripts / auto-update.sh
index 6b6b6f5..899f919 100755 (executable)
@@ -3,11 +3,12 @@
 
 function _svn_or_git () {
     where="$1"; [ -z "$where" ] && where="."
-    cd $where
+    pushd $where >& /dev/null
+    cd $(pwd -P)
     while true; do
-       [ -d .svn ] && { echo svn ; return ; }
-       [ -d .git ] && { echo git ; return ; }
-       [ "$(pwd -P)" == "/" ] && { echo none ; return ; }
+       [ -d .svn ] && { popd >& /dev/null; echo svn ; return ; }
+       [ -d .git ] && { popd >& /dev/null; echo git ; return ; }
+       [ "$(pwd -P)" == "/" ] && { popd >& /dev/null; echo none ; return ; }
        cd ..
     done
 }
@@ -26,7 +27,7 @@ fi
 
 ##########
 cd $DIRNAME
-case $(svn_or_git) in 
+case $(_svn_or_git) in 
     svn) (date ; svn update ) >& .auto-update.log ;;
     git) (date ; git pull ) >& .auto-update.log ;;
     *) echo 'only svn and git are supported' >& .auto-update.log ;;