gitk: cannot handle tags with a % in them
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Felipe Sateler wrote[1]:
Quoted 1 line
Gitk chokes on tags containing a % character.
Reproduced as follows:
git tag a%b
gitk
and then clicking on the "| a%b >" symbol.
Result:
can't read "tagids(foo1ar)": no such element in array can't read "tagids(foo1ar)": no such element in array
while executing
"set text "[mc "Tag"]: $tag\n[mc "Id"]: $tagids($tag)""
(procedure "showtag" line 19)
invoked from within
"showtag foo1ar 1"
(command bound to event)
It seems that a tag containing a percent sign works okay in an expression like $tagids($tag), but not in a quoted expression like "$tagids($tag)".
Hints?
Thanks for gitk, of course. :)
Jonathan
PATCH 1/1 gitk: ensure quoted tag names in event bindings
Tag names that contain a % character require quoting when used in event bindings or the name may be mis-recognised for percent substitution in the event script.
---
Quoted 28 lines · Jonathan Nieder
Hi,
Felipe Sateler wrote[1]:
Quoted 1 line
Gitk chokes on tags containing a % character.
Reproduced as follows:
git tag a%b
gitkand then clicking on the "| a%b >" symbol.
Result:
can't read "tagids(foo1ar)": no such element in array can't read "tagids(foo1ar)": no such element in array
while executing
"set text "[mc "Tag"]: $tag\n[mc "Id"]: $tagids($tag)""
(procedure "showtag" line 19)
invoked from within
"showtag foo1ar 1"
(command bound to event)It seems that a tag containing a percent sign works okay in an expression like $tagids($tag), but not in a quoted expression like "$tagids($tag)".
Quoted 6 lines
Hints?
Thanks for gitk, of course. :)
Jonathan
gitk | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
gitk +4 -3
@@ -6300,6 +6300,7 @@ proc drawtags {id x xt y1} { -width $lthickness -fill black -tags tag.$id] $canv lower $t foreach tag $marks x $xvals wid $wvals { + set tag_quoted [string map {% %%} $tag] set xl [expr {$x + $delta}] set xr [expr {$x + $delta + $wid + $lthickness}] set font mainfont
@@ -6308,7 +6309,7 @@ proc drawtags {id x xt y1} { set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \ $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \ -width 1 -outline black -fill yellow -tags tag.$id] - $canv bind $t <1> [list showtag $tag 1] + $canv bind $t <1> [list showtag $tag_quoted 1] set rowtextx([rowofcommit $id]) [expr {$xr + $linespc}] } else { # draw a head or other ref
@@ -6335,9 +6336,9 @@ proc drawtags {id x xt y1} { set t [$canv create text $xl $y1 -anchor w -text $tag -fill $fgcolor \ -font $font -tags [list tag.$id text]] if {$ntags >= 0} { - $canv bind $t <1> [list showtag $tag 1] + $canv bind $t <1> [list showtag $tag_quoted 1] } elseif {$nheads >= 0} { - $canv bind $t $ctxbut [list headmenu %X %Y $id $tag] + $canv bind $t $ctxbut [list headmenu %X %Y $id $tag_quoted] } } return $xt
Signature · 1 line
1.7.4.msysgit.0
Re: [PATCH] gitk: ensure quoted tag names in event bindings
Quoted 6 lines · Pat Thoyts
Tag names that contain a % character require quoting when used in event bindings or the name may be mis-recognised for percent substitution in the event script.
Reported-by Jonathan Nieder <[email protected]>Signed-off-by Pat Thoyts <[email protected]>
[...]
Quoted 3 lines
gitk | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
Thanks, makes sense (and seems to work).
Paul Mackerras
AppliedRe: [PATCH] gitk: ensure quoted tag names in event bindings
In reply to Pat ThoytsQuoted 6 lines · Pat Thoyts
Tag names that contain a % character require quoting when used in event bindings or the name may be mis-recognised for percent substitution in the event script.
Reported-by Jonathan Nieder <[email protected]>Signed-off-by Pat Thoyts <[email protected]>
Thanks, applied.
Paul.