@matheusbsbs / matheus-bagliano / commits / f31fa2c086
Fork 0

gitk: Fix handling of tree file list with special chars in names

Alex Riesen pointed out that displaying a commit in 'tree' mode fails if some files have names with special characters such as '{' or '}' in them, due to the fact that we treat the line returned from git ls-tree as a Tcl list at one point. This fixes it by doing what I originally intended but didn't quite get right. We split the line from git ls-tree at the first tab and treat the part before the tab as a list (which is OK since it doesn't have special characters in it) and the part after the tab as the filename. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Apr 28, 2008 at 09:40 UTC f31fa2c0864ba8b1292119fbb3942cdbaa0fb807
1 file changed +3 -2
gitk
+3 -2
@@ -4992,11 +4992,12 @@ proc gettreeline {gtf id} {
4992 if {$diffids eq $nullid} {
4993 set fname $line
4994 } else {
4995 - if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
4995 set i [string first "\t" $line]
4996 if {$i < 0} continue
4998 - set sha1 [lindex $line 2]
4997 set fname [string range $line [expr {$i+1}] end]
4998 + set line [string range $line 0 [expr {$i-1}]]
4999 + if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
5000 + set sha1 [lindex $line 2]
5001 if {[string index $fname 0] eq "\""} {
5002 set fname [lindex $fname 0]
5003 }