Skip to content

Commit 0060946

Browse files
committed
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 <[email protected]>
1 parent 43c2507 commit 0060946

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gitk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5502,10 +5502,16 @@ proc cherrypick {} {
55025502

55035503
# context menu for a head
55045504
proc headmenu {x y id head} {
5505-
global headmenuid headmenuhead headctxmenu
5505+
global headmenuid headmenuhead headctxmenu mainhead
55065506

55075507
set headmenuid $id
55085508
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
55095515
tk_popup $headctxmenu $x $y
55105516
}
55115517

@@ -5537,6 +5543,7 @@ proc rmbranch {} {
55375543

55385544
set head $headmenuhead
55395545
set id $headmenuid
5546+
# this check shouldn't be needed any more...
55405547
if {$head eq $mainhead} {
55415548
error_popup "Cannot delete the currently checked-out branch"
55425549
return

0 commit comments

Comments
 (0)