threads / patch / 13353

patchRe: [PATCH] gitk: disable "Reset %s branch to here" when on a detached head

Subject: Re: [PATCH] gitk: disable "Reset %s branch to here" when on a detached head

## tl;dr

3 messages between May 2, 2008 and May 2, 2008. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Paul Mackerras· May 2, 2008, 12:52 UTC · lore
Michele Ballabio writes:
> When we are on a detached head, reset has no sense, so disable
> the line on the context menu.
Sounds reasonable.
Show 5 quoted 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 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.
Michele Ballabio· May 2, 2008, 14:56 UTC · re: Paul Mackerras · lore
On Friday 02 May 2008, Paul Mackerras wrote:
Show 9 quoted 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 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. :)

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 :).

Michele Ballabio· May 2, 2008, 15:46 UTC · re: Michele Ballabio · lore

[PATCH] 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)
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
On Friday 02 May 2008, Michele Ballabio wrote:
Show 8 quoted lines
> On Friday 02 May 2008, Paul Mackerras wrote:
> > 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(-)
Show changes to gitk +5 −1
diff --git a/gitk b/gitk
index da685aa..23247ff 100755
--- a/gitk
+++ b/gitk
@@ -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
     }
-- 
1.5.5.1

← back to recent threads