Skip to contentSkip to conversation

gitk doesn't handle filenames with space correctly

PATCH In review Frédéric Jolliton 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitk doesn't handle filenames with space correctly

Hi,

Here is an attempt to fix gitk such that it can display filenames with space correctly, in the right column (Patch/Tree). I don't know TCL, so probably that a better solution exists.

gitk renamed from gitk.orig +2 -3
@@ -4114,8 +4114,7 @@
 
     while {[gets $gtf line] >= 0} {
 	if {[lindex $line 1] ne "blob"} continue
-	set sha1 [lindex $line 2]
-	set fname [lindex $line 3]
+	regexp {^[^ ]+ [^ ]+ ([^ ]+)\t(.*)} $line -> sha1 fname
 	lappend treefilelist($id) $fname
 	lappend treeidlist($id) $sha1
     }
@@ -4324,7 +4323,7 @@
 	}
 	return
     }
-    set file [lindex $line 5]
+    regexp {^[^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+\t(.*)} $line -> file
     lappend treediff $file
 }
 
Signature · 1 line
Frédéric Jolliton
#1 lore raw
Quoted 3 lines · Frédéric Jolliton

Here is an attempt to fix gitk such that it can display filenames with space correctly, in the right column (Patch/Tree). I don't know TCL, so probably that a better solution exists.

Thanks Frédéric!

This patch works great for me.

:)

Bernt