[PATCH 4/7] add reflog entries for HEAD when detached

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Nicolas Pitre <nico@xxxxxxx>
---
 git-checkout.sh |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-checkout.sh b/git-checkout.sh
index c52f352..ed344d8 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
-- 
1.5.0.rc2.g6e2c

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]