@matheusbsbs / matheus-bagliano / commits / 0060946397
Fork 0

gitk: Disable the head context menu entries for the checked-out branch

Neither the "check out this branch" nor the "remove this branch" menu item can be used on the currently-checked out branch, so disable them. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Jun 17, 2007 at 17:08 UTC 00609463979c3a2549c0c917a206345f51975b5d
1 file changed +8 -1
gitk
+8 -1
@@ -5502,10 +5502,16 @@ proc cherrypick {} {
5502
5503 # context menu for a head
5504 proc headmenu {x y id head} {
5505 - global headmenuid headmenuhead headctxmenu
5505 + global headmenuid headmenuhead headctxmenu mainhead
5506
5507 set headmenuid $id
5508 set headmenuhead $head
5509 + set state normal
5510 + if {$head eq $mainhead} {
5511 + set state disabled
5512 + }
5513 + $headctxmenu entryconfigure 0 -state $state
5514 + $headctxmenu entryconfigure 1 -state $state
5515 tk_popup $headctxmenu $x $y
5516 }
5517
@@ -5537,6 +5543,7 @@ proc rmbranch {} {
5543
5544 set head $headmenuhead
5545 set id $headmenuid
5546 + # this check shouldn't be needed any more...
5547 if {$head eq $mainhead} {
5548 error_popup "Cannot delete the currently checked-out branch"
5549 return