aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-04-28 09:40:50 +1000
committerPaul Mackerras <paulus@samba.org>2008-04-28 09:40:50 +1000
commitf31fa2c0864ba8b1292119fbb3942cdbaa0fb807 (patch)
tree1d447c29349eace01e3e81b4ff745da4dd8517be
parent80dd7b44970dee7d82fa735d2e0b828051f80545 (diff)
downloadgit-f31fa2c0864ba8b1292119fbb3942cdbaa0fb807.tar.gz
git-f31fa2c0864ba8b1292119fbb3942cdbaa0fb807.tar.xz
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>
-rwxr-xr-xgitk5
1 files changed, 3 insertions, 2 deletions
diff --git a/gitk b/gitk
index 9a4d9c40c..da685aa63 100755
--- a/gitk
+++ b/gitk
@@ -4992,11 +4992,12 @@ 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]
+ set line [string range $line 0 [expr {$i-1}]]
+ if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
+ set sha1 [lindex $line 2]
if {[string index $fname 0] eq "\""} {
set fname [lindex $fname 0]
}