summaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorSven Verdoolaege <skimo@kotnet.org>2007-05-09 12:33:20 +0200
committerJunio C Hamano <junkio@cox.net>2007-05-10 15:24:44 -0700
commit68db31cc289c686c4b4454dfbb121aff59a6c602 (patch)
treee2a02bc97e8afad4327f9ece6bc81ca497f26602 /git-checkout.sh
parent843142ada000a992fa87bd2dc7796501332a52d9 (diff)
downloadgit-68db31cc289c686c4b4454dfbb121aff59a6c602.tar.gz
git-update-ref: add --no-deref option for overwriting/detaching ref
git-checkout is also adapted to make use of this new option instead of the handcrafted command sequence. Signed-off-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh10
1 files changed, 1 insertions, 9 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index ed7c2c5f6a..6b6facfd5a 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