{"thread":{"id":"13353","subject":"Re: [PATCH] gitk: disable \"Reset %s branch to here\" when on a detached head","startedAt":"2008-05-02T12:52:04Z","lastAt":"2008-05-02T15:46:20Z","messageCount":3,"participants":["Paul Mackerras","Michele Ballabio"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"75830","messageId":"18459.3700.934377.597975@cargo.ozlabs.ibm.com","threadId":"13353","inReplyTo":"200803181535.53635.barra_cuda@katamail.com","subject":"Re: [PATCH] gitk: disable \"Reset %s branch to here\" when on a detached head","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-05-02T12:52:04Z","receivedAt":"2008-05-02T12:52:04Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Michele Ballabio writes:\n\n> When we are on a detached head, reset has no sense, so disable\n> the line on the context menu.\n\nSounds reasonable.\n\n> -\t$menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n> +\tif {$mainhead ne {}} {\n> +\t    $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n> +\t} else {\n> +\t    $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead] -state disabled\n\nI wonder if we can make this message something more appropriate than\n\"Reset  branch to here\" (since $mainhead has to be the empty string\nhere)?  Not sure what I would suggest though. :)\n\nPaul.\n"},{"id":"75849","messageId":"200805021656.57929.barra_cuda@katamail.com","threadId":"13353","inReplyTo":"18459.3700.934377.597975@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: disable \"Reset %s branch to here\" when on a detached head","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2008-05-02T14:56:57Z","receivedAt":"2008-05-02T14:56:57Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"On Friday 02 May 2008, Paul Mackerras wrote:\n> > -     $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n> > +     if {$mainhead ne {}} {\n> > +         $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n> > +     } else {\n> > +         $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead] -state disabled\n> \n> I wonder if we can make this message something more appropriate than\n> \"Reset  branch to here\" (since $mainhead has to be the empty string\n> here)?  Not sure what I would suggest though. :)\n\nOh, you're right. I'd say either \"Reset detached head to here\" greyed out\n(i.e. change the words as little as possible), or something more\nexplicative like \"Detached head: reset not possible\". I'd go for the first,\nbut I'm really not sure about this: you'd better seek suggestions from a\nnative speaker :).\n"},{"id":"75851","messageId":"200805021746.20883.barra_cuda@katamail.com","threadId":"13353","inReplyTo":"200805021656.57929.barra_cuda@katamail.com","subject":"[PATCH] gitk: disable \"Reset %s branch to here\" when on a detached head","fromName":"Michele Ballabio","fromEmail":"barra_cuda@katamail.com","sentAt":"2008-05-02T15:46:20Z","receivedAt":"2008-05-02T15:46:20Z","isPatch":true,"sender":{"key":"barra_cuda@katamail.com","avatar":"https://avatars.githubusercontent.com/u/16371673?v=4"},"body":"When we are on a detached head - since gitk does not display where\nwe are - reset has no sense, so disable the relevant line on the\ncontext menu, and point out to the user that we are on a detached head.\n\nOtherwise, a reset from gitk when on a detached head returns the\nerror:\n\ncan't read \"headids()\": no such element in array\ncan't read \"headids()\": no such element in array\n    while executing\n\"removehead $headids($name) $name\"\n    (procedure \"movehead\" line 4)\n    invoked from within\n\"movehead $newhead $mainhead\"\n    (procedure \"readresetstat\" line 20)\n    invoked from within\n\"readresetstat file4\"\n    (\"eval\" body line 1)\n    invoked from within\n\"eval $script\"\n    (procedure \"dorunq\" line 9)\n    invoked from within\n\"dorunq\"\n    (\"after\" script)\n\nSigned-off-by: Michele Ballabio <barra_cuda@katamail.com>\n---\n\nOn Friday 02 May 2008, Michele Ballabio wrote:\n> On Friday 02 May 2008, Paul Mackerras wrote:\n> > I wonder if we can make this message something more appropriate than\n> > \"Reset  branch to here\" (since $mainhead has to be the empty string\n> > here)?  Not sure what I would suggest though. :)\n> \n> Oh, you're right. I'd say either \"Reset detached head to here\" greyed out\n> (i.e. change the words as little as possible), or something more\n> explicative like \"Detached head: reset not possible\". I'd go for the first,\n\nHere's the updated patch.\n\n gitk |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex da685aa..23247ff 100755\n--- a/gitk\n+++ b/gitk\n@@ -6016,7 +6016,11 @@ proc rowmenu {x y id} {\n     }\n     if {$id ne $nullid && $id ne $nullid2} {\n \tset menu $rowctxmenu\n-\t$menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n+\tif {$mainhead ne {}} {\n+\t    $menu entryconfigure 7 -label [mc \"Reset %s branch to here\" $mainhead]\n+\t} else {\n+\t    $menu entryconfigure 7 -label [mc \"Reset detached head to here\" $mainhead] -state disabled\n+\t}\n     } else {\n \tset menu $fakerowmenu\n     }\n-- \n1.5.5.1\n"}]}