X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-checkout.sh;h=33f1e87c0c209b89eb785381db62d826818b602d;hb=a2f8028d3d661b314d5a784764f2f5f9e4c2dde0;hp=7c5ca3d62f85b78ec82f02c2045435d889c32cdd;hpb=4f01d0f92db5cb38aaaab83adb50557beb35fb91;p=git.git diff --git a/git-checkout.sh b/git-checkout.sh index 7c5ca3d62..33f1e87c0 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -211,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 @@ -246,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 @@ -271,15 +271,7 @@ if [ "$?" -eq 0 ]; then fi elif test -n "$detached" then - # NEEDSWORK: we would want a command to detach the HEAD - # atomically, instead of this handcrafted command sequence. - # Perhaps: - # git update-ref --detach HEAD $new - # or something like that... - # - git-rev-parse HEAD >"$GIT_DIR/HEAD.new" && - mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" && - git-update-ref -m "checkout: moving to $arg" HEAD "$detached" || + git-update-ref --no-deref -m "checkout: moving to $arg" HEAD "$detached" || die "Cannot detach HEAD" if test -n "$detach_warn" then