Re: [PATCH (GIT-GUI,GITK) 6/8] gitk: Port new encoding logic from git-gui.
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:45:23
Alexander Gavrilov schrieb:
Subject: [PATCH] gitk: Implement batch lookup and caching of encoding attrs. When the diff contains thousands of files, calling git-check-attr once per file is very slow. With this patch gitk does attribute lookup in batches of 30 files while reading the diff file list, which leads to a very noticeable speedup.
This one does not work for me: The correct is not picked up anymore, neither in Patch mode nor Tree mode. (It works as expected without this patch.)
+proc cache_gitattr {attr pathlist} {
+ global path_attr_cache
+ set newlist {}
+ foreach path $pathlist {
+ if {[info exists path_attr_cache($attr,$path)]} continue
+ lappend newlist $path
+ }
+ while {$newlist ne {}} {
+ set head [lrange $newlist 0 29]
+ set newlist [lrange $newlist 30 end]
+ if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {
+ foreach row [split $rlist "\n"] {
+ set cols [split $row :]This colon made me nervous (because of the drive-colon combination on Windows), but as long as you feed relative paths into 'git check-attr', this should not matter (in my case).
+ set path [lindex $cols 0]
+ set value [join [lrange $cols 2 end] :]
+ if {[string index $path 0] eq "\""} {
+ set path [encoding convertfrom [lindex $path 0]]
+ }
+ set path_attr_cache($attr,$path) $value
+ }
+ }
+ update
+ }
+}