gitk: disable "Reset %s branch to here" when on a detached head
Quoted 2 lines · Michele Ballabio
When we are on a detached head, reset has no sense, so disable the line on the context menu.
Sounds reasonable.
Review
Quoted 5 lines
(quoted diff) +4
-1- $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + if {$mainhead ne {}} { + $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + } else { + $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] -state disabled
I wonder if we can make this message something more appropriate than "Reset branch to here" (since $mainhead has to be the empty string here)? Not sure what I would suggest though. :)
Paul.
Quoted 9 lines · Paul Mackerras
Quoted 5 lines
- $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
+ if {$mainhead ne {}} {
+ $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + } else {
+ $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] -state disabledI wonder if we can make this message something more appropriate than "Reset branch to here" (since $mainhead has to be the empty string here)? Not sure what I would suggest though. :)
Oh, you're right. I'd say either "Reset detached head to here" greyed out (i.e. change the words as little as possible), or something more explicative like "Detached head: reset not possible". I'd go for the first, but I'm really not sure about this: you'd better seek suggestions from a native speaker :).
PATCH 1/1 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)
---
Quoted 8 lines · Michele Ballabio
Quoted 3 lines · Paul Mackerras
I wonder if we can make this message something more appropriate than "Reset branch to here" (since $mainhead has to be the empty string here)? Not sure what I would suggest though. :)
Oh, you're right. I'd say either "Reset detached head to here" greyed out (i.e. change the words as little as possible), or something more explicative like "Detached head: reset not possible". I'd go for the first,
Here's the updated patch.
gitk | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
gitk +5 -1
@@ -6016,7 +6016,11 @@ proc rowmenu {x y id} { } if {$id ne $nullid && $id ne $nullid2} { set menu $rowctxmenu - $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + if {$mainhead ne {}} { + $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + } else { + $menu entryconfigure 7 -label [mc "Reset detached head to here" $mainhead] -state disabled + } } else { set menu $fakerowmenu }
Signature · 1 line
1.5.5.1