X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-checkout.sh;h=33f1e87c0c209b89eb785381db62d826818b602d;hb=0cae23467ada9b94210a0e770064841efea8ad40;hp=6b6facfd5a224afca735d4693d304726f4032e6f;hpb=738a1154db190c75a7454da85d85be68ad7db065;p=git.git diff --git a/git-checkout.sh b/git-checkout.sh index 6b6facfd5..33f1e87c0 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -63,12 +63,13 @@ while [ "$#" != "0" ]; do echo "unknown flag $arg" exit 1 fi - new="$rev" new_name="$arg" if git-show-ref --verify --quiet -- "refs/heads/$arg" then + rev=$(git-rev-parse --verify "refs/heads/$arg^0") branch="$arg" fi + new="$rev" elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null) then # checking out selected paths from a tree-ish. @@ -210,7 +211,7 @@ else esac # Match the index to the working tree, and do a three-way. - git diff-files --name-only | git update-index --remove --stdin && + git diff-files --name-only | git update-index --remove --stdin && work=`git write-tree` && git read-tree $v --reset -u $new || exit @@ -245,7 +246,7 @@ else (exit $saved_err) fi -# +# # Switch the HEAD pointer to the new branch if we # checked out a branch head, and remove any potential # old MERGE_HEAD's (subsequent commits will clearly not