summaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2007-01-26 22:26:08 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-28 10:16:46 (GMT)
commite1dde3d06c7caa242dd4b419aebb9a9b7fee2d48 (patch)
treec299da76981ed2815b9e190ce845d16aa3889036 /git-checkout.sh
parentbd104db164d7f2a714aa0f1cdf89fd89fee6c00a (diff)
downloadgit-e1dde3d06c7caa242dd4b419aebb9a9b7fee2d48.zip
git-e1dde3d06c7caa242dd4b419aebb9a9b7fee2d48.tar.gz
git-e1dde3d06c7caa242dd4b419aebb9a9b7fee2d48.tar.bz2
add reflog entries for HEAD when detached
Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index 8500f51..ac378cd 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -259,8 +259,9 @@ if [ "$?" -eq 0 ]; then
# git update-ref --detach HEAD $new
# or something like that...
#
- echo "$detached" >"$GIT_DIR/HEAD.new" &&
- mv "$GIT_DIR/HEAD.new" "$GIT_DIR/HEAD" ||
+ 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" ||
die "Cannot detach HEAD"
if test -n "$detach_warn"
then