cvsserver: Introduce new state variable 'method'
[gitweb.git] / git-checkout.sh
index 6caa9fdcc660b6fee063bfccbc51e46331e911c7..3c9b1bb05a7409018e85f170793ba353b780ddce 100755 (executable)
@@ -89,7 +89,7 @@ while [ "$#" != "0" ]; do
     esac
 done
 
-case "$new_branch,$track" in
+case "$newbranch,$track" in
 ,--*)
        die "git checkout: --track and --no-track require -b"
 esac
@@ -205,7 +205,7 @@ else
        work=`git write-tree` &&
        git read-tree --reset -u $new || exit
 
-       eval GITHEAD_$new=${new_name:-${branch:-$new}} &&
+       eval GITHEAD_$new='${new_name:-${branch:-$new}}' &&
        eval GITHEAD_$work=local &&
        export GITHEAD_$new GITHEAD_$work &&
        git merge-recursive $old -- $new $work
@@ -250,8 +250,13 @@ if [ "$?" -eq 0 ]; then
        if test -n "$branch"
        then
                GIT_DIR="$GIT_DIR" git-symbolic-ref -m "checkout: moving to $branch" HEAD "refs/heads/$branch"
-               if test -z "$quiet"
+               if test -n "$quiet"
                then
+                       true    # nothing
+               elif test "refs/heads/$branch" = "$oldbranch"
+               then
+                       echo >&2 "Already on branch \"$branch\""
+               else
                        echo >&2 "Switched to${newbranch:+ a new} branch \"$branch\""
                fi
        elif test -n "$detached"