Code

Move the pick_author code to git-sh-setup
[git.git] / git-checkout.sh
index 7c5ca3d62f85b78ec82f02c2045435d889c32cdd..33f1e87c0c209b89eb785381db62d826818b602d 100755 (executable)
@@ -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