From 68db31cc289c686c4b4454dfbb121aff59a6c602 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 9 May 2007 12:33:20 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- git-checkout.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'git-checkout.sh') 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 -- cgit v1.2.3