diff --git a/bin/sde-update-tree b/bin/sde-update-tree index b3257d2..bd9af2f 100755 --- a/bin/sde-update-tree +++ b/bin/sde-update-tree @@ -64,16 +64,17 @@ tree="${SDEROOT##*/}" update_git() { + local prefix="$1" local branch=$( git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||' ) local remote=$( git config branch.$branch.remote ) local remote_list=$( git remote ) local remote_branch= remote_branch_list= if [ -z "$remote_list" ]; then - echo "no remotes set" + echo "$prefix: no remotes set" return 0 elif [ -n "$remote" -a -z "$( echo "$remote_list" | grep "^$remote\$" )" ]; then - echo "$remote: what?! remote is gone!" + echo "$prefix: what?! '$remote' is gone!" return 1 elif [ -z "$remote" ]; then # uhm, get a good remote @@ -87,7 +88,7 @@ update_git() remote_branch_list=$( git branch -r | sed -n -e "s|^ $remote/||p" | grep -v '^HEAD$' ) if [ -z "$remote_branch_list" ]; then - echo "no remote set, and couldn't guess". + echo "$prefix: no remote set, and couldn't guess one". return 1 elif [ "$( echo "$remote_branch_list" | grep "^$branch$" )" ]; then remote_branch="$branch" @@ -97,12 +98,14 @@ update_git() remote_branch="$( echo "$remote_branch_list" | head -n 1 )" fi - echo "no remote set, assuming $remote/$remote_branch." + echo "$prefix: no remote set, assuming $remote/$remote_branch." git config branch.$branch.remote "$remote" git config branch.$branch.merge "refs/heads/$remote_branch" + else + echo "$prefix:" fi - git reset && git pull --rebase + ( git reset && git pull --rebase ) 2>&1 | indent_output } update_svn() @@ -135,10 +138,7 @@ for x in . package $( ls -1d package/* target/* 2> /dev/null ); do ;; esac elif [ -d "$x/.git" ]; then - cd "$x"; - echo "$tree/$x:" - update_git 2>&1 | indent_output - cd - > /dev/null + ( cd "$x"; update_git "$tree/$x" ) elif [ -d "$x/.svn" ]; then ( cd "$x"; update_svn "$tree/$x" ) fi