@matheusbsbs / matheus-bagliano / commits / 881d8f24ca
Fork 0

git-gui: Fix detaching current branch during checkout

If the user tried to detach their HEAD while keeping the working directory on the same commit we actually did not completely do a detach operation internally. The problem was caused by git-gui not forcing the HEAD symbolic ref to be updated to a SHA-1 hash when we were not switching revisions. Now we update the HEAD ref if we aren't currently detached or the hashes don't match. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Sep 2, 2007 at 15:30 UTC 881d8f24cab5bf4e0fa71b17a3ab82e27b2e8ed7
1 file changed +1 -1
lib/checkout_op.tcl
+1 -1
@@ -396,7 +396,7 @@ method _after_readtree {} {
396 set is_detached 0
397 }
398 } else {
399 - if {$new_hash ne $HEAD} {
399 + if {!$is_detached || $new_hash ne $HEAD} {
400 append log " to $new_expr"
401 if {[catch {
402 _detach_HEAD $log $new_hash