Re: [PATCH (GIT-GUI,GITK) 6/8] gitk: Port new encoding logic from git-gui.
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Sep 22, 2008, 07:46 UTC
- Message-ID
- <48D74D69.4010802@viscovery.net>
- In-Reply-To
- <48D74877.9050607@viscovery.net>
Johannes Sixt schrieb:
Show 9 quoted lines
> 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,
The correct _encoding_ is not picked up anymore...
Show 20 quoted lines
> 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).This comment does not imply that I debugged this code. I just noticed the colon while reading the patch.
Show 11 quoted lines
>> + 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
>> + }
>> +}