"branch" command: always branch off master, not off HEAD, unless a branch is specified
authorRudolf Polzer <rpolzer@grawp.(none)>
Mon, 5 Apr 2010 11:48:23 +0000 (13:48 +0200)
committerRudolf Polzer <rpolzer@grawp.(none)>
Mon, 5 Apr 2010 11:48:23 +0000 (13:48 +0200)
all

diff --git a/all b/all
index 72601766d029ec3c37dd8126ec4300721ec6a2a6..c94d71b36be26690535cbbf9a8626a25694da14b 100755 (executable)
--- a/all
+++ b/all
@@ -198,10 +198,14 @@ case "$cmd" in
        branch)
                remote=$1
                branch=$2
+               srcbranch=$3
                if [ -z "$branch" ]; then
                        branch=$remote
                        remote=origin
                fi
+               if [ -z "$srcbranch" ]; then
+                       srcbranch=master
+               fi
                if [ -z "$branch" ]; then
                        for d in $repos; do
                                enter "$d0/$d"
@@ -220,7 +224,7 @@ case "$cmd" in
                                        read -r a
                                done
                                if [ x"$a" = x"y" ]; then
-                                       verbose git push "$remote" HEAD:"$branch"
+                                       verbose git push "$remote" "$srcbranch":"$branch"
                                        verbose git checkout --track -b "$branch" "$remote/$branch"
                                fi
                                cd "$d0"
@@ -344,6 +348,7 @@ case "$cmd" in
                echo "  $SELF push"
                echo "  $SELF branches"
                echo "  $SELF branch [<remote>] <branchname>"
+               echo "  $SELF branch <remote> <branchname> <srcbranchname>"
                echo "  $SELF checkout [<remote>] <branchname>"
                echo "  $SELF compile"
                echo "  $SELF run <client> <options>"