git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix tree mode of the file list for files containing curly brackets
@ 2008-03-14 21:49 Alex Riesen
  2008-03-14 21:58 ` [PATCH] " Alex Riesen
  2008-04-27 10:57 ` [RESEND] " Alex Riesen
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Riesen @ 2008-03-14 21:49 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git, Junio C Hamano

As far as I could understand the online documentation the [lindex ...]
thing expects an array, which a string produced by git-ls-tree is not.
So [split ...] it first, to get a real Tcl string-array.

For instance:

    $ git init
    $ date >file
    $ git add . && git commit -m1
    $ git mv file '{a-b}.a.b'
    $ git commit -m2
    $ gitk

Now switch the file list from "Patch" to "Tree":

    list element in braces followed by ".a.b" instead of space
    list element in braces followed by ".a.b" instead of space
	while executing
    "lindex $line 1"
	(procedure "gettreeline" line 9)
	invoked from within
    "gettreeline file11 4b155a05282eeccd7c8fd381b22ed442efde2850"
	("eval" body line 1)
	invoked from within
    "eval $script"
	(procedure "dorunq" line 9)
	invoked from within
    "dorunq"
	("after" script)

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>

--

My workaround for the problem was the patch attached, but as I know
next to nothing of Tcl, I suspect it is at least incomplete (there
could be other places with the same problem).

diff --git a/gitk-git/gitk b/gitk-git/gitk
index f1f21e9..3368148 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -4946,14 +4946,10 @@ proc gettreeline {gtf id} {
 	if {$diffids eq $nullid} {
 	    set fname $line
 	} else {
-	    if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
-	    set i [string first "\t" $line]
-	    if {$i < 0} continue
-	    set sha1 [lindex $line 2]
-	    set fname [string range $line [expr {$i+1}] end]
-	    if {[string index $fname 0] eq "\""} {
-		set fname [lindex $fname 0]
-	    }
+	    set la [split "$line" " \t"]
+	    if {$diffids ne $nullid2 && [lindex $la 1] ne "blob"} continue
+	    set sha1 [lindex $la 2]
+	    set fname [lindex $la 3]
 	    lappend treeidlist($id) $sha1
 	}
 	lappend treefilelist($id) $fname

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

end of thread, other threads:[~2008-04-27 16:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 21:49 Fix tree mode of the file list for files containing curly brackets Alex Riesen
2008-03-14 21:58 ` [PATCH] " Alex Riesen
2008-04-27 10:57 ` [RESEND] " Alex Riesen
2008-04-27 11:53   ` Paul Mackerras
2008-04-27 16:51     ` Alex Riesen

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