From: Josef Weidendorfer Date: Wed, 15 Feb 2006 19:22:11 +0000 (+0100) Subject: More useful/hinting error messages in git-checkout X-Git-Tag: v1.2.1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e93f19bd6cab17c507792599b8a22f7b567ef516;p=git.git More useful/hinting error messages in git-checkout Signed-off-by: Josef Weidendorfer Signed-off-by: Junio C Hamano --- diff --git a/git-checkout.sh b/git-checkout.sh index 76e7f5522..463ed2eaf 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do [ -e "$GIT_DIR/refs/heads/$newbranch" ] && die "git checkout: branch $newbranch already exists" git-check-ref-format "heads/$newbranch" || - die "we do not like '$newbranch' as a branch name." + die "git checkout: we do not like '$newbranch' as a branch name." ;; "-f") force=1 @@ -75,9 +75,15 @@ done if test "$#" -ge 1 then + hint= + if test "$#" -eq 1 + then + hint=" +Did you intend to checkout '$@' which can not be resolved as commit?" + fi if test '' != "$newbranch$force$merge" then - die "updating paths and switching branches or forcing are incompatible." + die "git checkout: updating paths is incompatible with switching branches/forcing$hint" fi if test '' != "$new" then @@ -117,7 +123,8 @@ fi [ -z "$branch$newbranch" ] && [ "$new" != "$old" ] && - die "git checkout: you need to specify a new branch name" + die "git checkout: to checkout the requested commit you need to specify + a name for a new branch which is created and switched to" if [ "$force" ] then