revert/cherry-pick: allow starting from dirty work tree.
[gitweb.git] / git-checkout.sh
index e00b697fef66adecaade1b9f6e7b7600f822e251..17f43927aa7b766c1ba28150c4945fac7ff3e132 100755 (executable)
@@ -259,7 +259,8 @@ if [ "$?" -eq 0 ]; then
        fi
        if test -n "$branch"
        then
-               GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving to $branch" HEAD "refs/heads/$branch"
+               old_branch_name=`expr "z$oldbranch" : 'zrefs/heads/\(.*\)'`
+               GIT_DIR="$GIT_DIR" git symbolic-ref -m "checkout: moving from $old_branch_name to $branch" HEAD "refs/heads/$branch"
                if test -n "$quiet"
                then
                        true    # nothing