fix the ./all script again ;) this time: missing div0-stable
authorRudolf Polzer <divverent@alientrap.org>
Thu, 17 Jun 2010 07:20:26 +0000 (09:20 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 17 Jun 2010 07:20:26 +0000 (09:20 +0200)
all

diff --git a/all b/all
index 15a6a150d3e22c406edc8baa1d5ef6f695620490..8b2caa053f7382a23ca821f1192265dc69f70529 100755 (executable)
--- a/all
+++ b/all
@@ -250,19 +250,25 @@ case "$cmd" in
                exists=false
                for d in $repos; do
                        enter "$d0/$d" verbose
-                       if [ -z "$branch" ]; then
-                               b=`repobranch "$d"`
-                       else
-                               b=$branch
-                       fi
-                       if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
+                       b=$branch
+                       if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
                                exists=true
                                verbose git checkout "$b"
-                       elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
+                       elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
                                exists=true
                                verbose git checkout --track -b "$b" "$remote/$b"
                        else
-                               verbose git checkout "`repobranch "$d"`"
+                               b=`repobranch "$d"`
+                               if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
+                                       exists=true
+                                       verbose git checkout "$b"
+                               elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
+                                       exists=true
+                                       verbose git checkout --track -b "$b" "$remote/$b"
+                               else
+                                       echo "WTF? Not even branch $b doesn't exist in $d"
+                                       exit 1
+                               fi
                        fi
                        cd "$d00"
                        checkself "$cmd" "$@"