git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: gitk: cannot handle tags with a % in them
       [not found] <20110227224024.3751.96676.reportbug@pcfelipe.sateler>
@ 2011-03-01  1:38 ` Jonathan Nieder
  2011-03-01 23:50   ` [PATCH] gitk: ensure quoted tag names in event bindings Pat Thoyts
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Nieder @ 2011-03-01  1:38 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Pat Thoyts, Felipe Sateler

Hi,

Felipe Sateler wrote[1]:

> 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

[1] http://bugs.debian.org/615645

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] gitk: ensure quoted tag names in event bindings
  2011-03-01  1:38 ` gitk: cannot handle tags with a % in them Jonathan Nieder
@ 2011-03-01 23:50   ` Pat Thoyts
  2011-03-02  5:47     ` Jonathan Nieder
  2011-03-09 10:05     ` Paul Mackerras
  0 siblings, 2 replies; 4+ messages in thread
From: Pat Thoyts @ 2011-03-01 23:50 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Paul Mackerras, Felipe Sateler

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 <jrnieder@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---

Jonathan Nieder <jrnieder@gmail.com> writes:

>Hi,
>
>Felipe Sateler wrote[1]:
>
>> 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
>
>[1] http://bugs.debian.org/615645

 gitk |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gitk b/gitk
index 9cbc09d..6513537 100755
--- a/gitk
+++ b/gitk
@@ -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
-- 
1.7.4.msysgit.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitk: ensure quoted tag names in event bindings
  2011-03-01 23:50   ` [PATCH] gitk: ensure quoted tag names in event bindings Pat Thoyts
@ 2011-03-02  5:47     ` Jonathan Nieder
  2011-03-09 10:05     ` Paul Mackerras
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Nieder @ 2011-03-02  5:47 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git, Paul Mackerras, Felipe Sateler

Pat Thoyts wrote:

> 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 <jrnieder@gmail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
[...]
> 
>  gitk |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)

Thanks, makes sense (and seems to work).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitk: ensure quoted tag names in event bindings
  2011-03-01 23:50   ` [PATCH] gitk: ensure quoted tag names in event bindings Pat Thoyts
  2011-03-02  5:47     ` Jonathan Nieder
@ 2011-03-09 10:05     ` Paul Mackerras
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2011-03-09 10:05 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: Jonathan Nieder, git, Felipe Sateler

On Tue, Mar 01, 2011 at 11:50:50PM +0000, Pat Thoyts wrote:

> 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 <jrnieder@gmail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Thanks, applied.

Paul.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-09 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110227224024.3751.96676.reportbug@pcfelipe.sateler>
2011-03-01  1:38 ` gitk: cannot handle tags with a % in them Jonathan Nieder
2011-03-01 23:50   ` [PATCH] gitk: ensure quoted tag names in event bindings Pat Thoyts
2011-03-02  5:47     ` Jonathan Nieder
2011-03-09 10:05     ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).