@matheusbsbs / matheus-bagliano / commits / 5e3502dabb
Fork 0

gitk: Disable "Reset %s branch to here" when on a detached head

When we are on a detached head - since gitk does not display where we are - reset has no sense, so disable the relevant line on the context menu, and point out to the user that we are on a detached head. Otherwise, a reset from gitk when on a detached head returns the error: can't read "headids()": no such element in array can't read "headids()": no such element in array while executing "removehead $headids($name) $name" (procedure "movehead" line 4) invoked from within "movehead $newhead $mainhead" (procedure "readresetstat" line 20) invoked from within "readresetstat file4" ("eval" body line 1) invoked from within "eval $script" (procedure "dorunq" line 9) invoked from within "dorunq" ("after" script) [paulus@samba.org: changed menu item to "Detached head: can't reset"] Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>

Michele Ballabio committed May 2, 2008 at 17:46 UTC 5e3502dabb6e95e3d9420e010276f832cb68e396
1 file changed +5 -1
gitk
+5 -1
@@ -6016,7 +6016,11 @@ proc rowmenu {x y id} {
6016 }
6017 if {$id ne $nullid && $id ne $nullid2} {
6018 set menu $rowctxmenu
6019 - $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
6019 + if {$mainhead ne {}} {
6020 + $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
6021 + } else {
6022 + $menu entryconfigure 7 -label [mc "Detached head: can't reset" $mainhead] -state disabled
6023 + }
6024 } else {
6025 set menu $fakerowmenu
6026 }