git grep shows the same hit repeatedly for unmerged paths
[gitweb.git] / git-checkout.sh
index e00b697fef66adecaade1b9f6e7b7600f822e251..5ca71242e7e41662b2ab960566b2e5fa32e89da9 100755 (executable)
@@ -169,7 +169,7 @@ detach_warn=
 describe_detached_head () {
        test -n "$quiet" || {
                printf >&2 "$1 "
-               GIT_PAGER= git log >&2 -1 --pretty=oneline --abbrev-commit "$2"
+               GIT_PAGER= git log >&2 -1 --pretty=oneline --abbrev-commit "$2" --
        }
 }
 
@@ -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