Merge branch 'fixes'
[gitweb.git] / git-checkout.sh
index 4a605cd9c6d76dc99ab0574dc3571db3b64e509c..c3825904b60d36edca96506d7f451cf0349b262d 100755 (executable)
@@ -22,7 +22,8 @@ while [ "$#" != "0" ]; do
                force=1
                ;;
        *)
-               rev=$(git-rev-parse --verify "$arg^0") || exit
+               rev=$(git-rev-parse --verify "$arg^0" 2>/dev/null) ||
+                       die "I don't know any '$arg'."
                if [ -z "$rev" ]; then
                        echo "unknown flag $arg"
                        exit 1
@@ -70,7 +71,8 @@ if [ "$?" -eq 0 ]; then
                echo $new > "$GIT_DIR/refs/heads/$newbranch"
                branch="$newbranch"
        fi
-       [ "$branch" ] && ln -sf "refs/heads/$branch" "$GIT_DIR/HEAD"
+       [ "$branch" ] &&
+       GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD "refs/heads/$branch"
        rm -f "$GIT_DIR/MERGE_HEAD"
 else
        exit 1