{"thread":{"id":"26629","subject":"Re: gitk: cannot handle tags with a % in them","startedAt":"2011-03-01T01:38:41Z","lastAt":"2011-03-09T10:05:47Z","messageCount":4,"participants":["Jonathan Nieder","Pat Thoyts","Paul Mackerras"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"162506","messageId":"20110301013841.GC5597@elie","threadId":"26629","inReplyTo":"20110227224024.3751.96676.reportbug@pcfelipe.sateler","subject":"Re: gitk: cannot handle tags with a % in them","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-01T01:38:41Z","receivedAt":"2011-03-01T01:38:41Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nFelipe Sateler wrote[1]:\n\n> Gitk chokes on tags containing a % character.\n\nReproduced as follows:\n\n\tgit tag a%b\n\tgitk\n\nand then clicking on the \"| a%b >\" symbol.\n\nResult:\n\n\tcan't read \"tagids(foo1ar)\": no such element in array\n\tcan't read \"tagids(foo1ar)\": no such element in array\n\t    while executing\n\t\"set text \"[mc \"Tag\"]: $tag\\n[mc \"Id\"]:  $tagids($tag)\"\"\n\t    (procedure \"showtag\" line 19)\n\t    invoked from within\n\t\"showtag foo1ar 1\"\n\t    (command bound to event)\n\nIt seems that a tag containing a percent sign works okay in\nan expression like $tagids($tag), but not in a quoted expression\nlike \"$tagids($tag)\".\n\nHints?\n\nThanks for gitk, of course. :)\nJonathan\n\n[1] http://bugs.debian.org/615645\n"},{"id":"162609","messageId":"87tyfmqu1x.fsf_-_@fox.patthoyts.tk","threadId":"26629","inReplyTo":"20110301013841.GC5597@elie","subject":"[PATCH] gitk: ensure quoted tag names in event bindings","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-03-01T23:50:50Z","receivedAt":"2011-03-01T23:50:50Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Tag names that contain a % character require quoting when used in event\nbindings or the name may be mis-recognised for percent substitution in\nthe event script.\n\nReported-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n---\n\nJonathan Nieder <jrnieder@gmail.com> writes:\n\n>Hi,\n>\n>Felipe Sateler wrote[1]:\n>\n>> Gitk chokes on tags containing a % character.\n>\n>Reproduced as follows:\n>\n>\tgit tag a%b\n>\tgitk\n>\n>and then clicking on the \"| a%b >\" symbol.\n>\n>Result:\n>\n>\tcan't read \"tagids(foo1ar)\": no such element in array\n>\tcan't read \"tagids(foo1ar)\": no such element in array\n>\t    while executing\n>\t\"set text \"[mc \"Tag\"]: $tag\\n[mc \"Id\"]:  $tagids($tag)\"\"\n>\t    (procedure \"showtag\" line 19)\n>\t    invoked from within\n>\t\"showtag foo1ar 1\"\n>\t    (command bound to event)\n>\n>It seems that a tag containing a percent sign works okay in\n>an expression like $tagids($tag), but not in a quoted expression\n>like \"$tagids($tag)\".\n>\n>Hints?\n>\n>Thanks for gitk, of course. :)\n>Jonathan\n>\n>[1] http://bugs.debian.org/615645\n\n gitk |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 9cbc09d..6513537 100755\n--- a/gitk\n+++ b/gitk\n@@ -6300,6 +6300,7 @@ proc drawtags {id x xt y1} {\n \t       -width $lthickness -fill black -tags tag.$id]\n     $canv lower $t\n     foreach tag $marks x $xvals wid $wvals {\n+\tset tag_quoted [string map {% %%} $tag]\n \tset xl [expr {$x + $delta}]\n \tset xr [expr {$x + $delta + $wid + $lthickness}]\n \tset font mainfont\n@@ -6308,7 +6309,7 @@ proc drawtags {id x xt y1} {\n \t    set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \\\n \t\t       $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n \t\t       -width 1 -outline black -fill yellow -tags tag.$id]\n-\t    $canv bind $t <1> [list showtag $tag 1]\n+\t    $canv bind $t <1> [list showtag $tag_quoted 1]\n \t    set rowtextx([rowofcommit $id]) [expr {$xr + $linespc}]\n \t} else {\n \t    # draw a head or other ref\n@@ -6335,9 +6336,9 @@ proc drawtags {id x xt y1} {\n \tset t [$canv create text $xl $y1 -anchor w -text $tag -fill $fgcolor \\\n \t\t   -font $font -tags [list tag.$id text]]\n \tif {$ntags >= 0} {\n-\t    $canv bind $t <1> [list showtag $tag 1]\n+\t    $canv bind $t <1> [list showtag $tag_quoted 1]\n \t} elseif {$nheads >= 0} {\n-\t    $canv bind $t $ctxbut [list headmenu %X %Y $id $tag]\n+\t    $canv bind $t $ctxbut [list headmenu %X %Y $id $tag_quoted]\n \t}\n     }\n     return $xt\n-- \n1.7.4.msysgit.0\n"},{"id":"162621","messageId":"20110302054629.GB27567@elie","threadId":"26629","inReplyTo":"87tyfmqu1x.fsf_-_@fox.patthoyts.tk","subject":"Re: [PATCH] gitk: ensure quoted tag names in event bindings","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-03-02T05:47:05Z","receivedAt":"2011-03-02T05:47:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Pat Thoyts wrote:\n\n> Tag names that contain a % character require quoting when used in event\n> bindings or the name may be mis-recognised for percent substitution in\n> the event script.\n> \n> Reported-by: Jonathan Nieder <jrnieder@gmail.com>\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n[...]\n> \n>  gitk |    7 ++++---\n>  1 files changed, 4 insertions(+), 3 deletions(-)\n\nThanks, makes sense (and seems to work).\n"},{"id":"163052","messageId":"20110309100547.GA4014@brick.ozlabs.ibm.com","threadId":"26629","inReplyTo":"87tyfmqu1x.fsf_-_@fox.patthoyts.tk","subject":"Re: [PATCH] gitk: ensure quoted tag names in event bindings","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2011-03-09T10:05:47Z","receivedAt":"2011-03-09T10:05:47Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Tue, Mar 01, 2011 at 11:50:50PM +0000, Pat Thoyts wrote:\n\n> Tag names that contain a % character require quoting when used in event\n> bindings or the name may be mis-recognised for percent substitution in\n> the event script.\n> \n> Reported-by: Jonathan Nieder <jrnieder@gmail.com>\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nThanks, applied.\n\nPaul.\n"}]}