X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=git-checkout.sh;h=6b6facfd5a224afca735d4693d304726f4032e6f;hb=ed82edc402c271a707da632083f1f4c19155d573;hp=ed7c2c5f6aab338c844329e3ae3d9c7ce003680f;hpb=ffcc952b33575e28b971d63ba2b7e46b7726a257;p=git.git diff --git a/git-checkout.sh b/git-checkout.sh index ed7c2c5f6..6b6facfd5 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -270,15 +270,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