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:25 UTC
- Message-ID
- <48D74877.9050607@viscovery.net>
- In-Reply-To
- <200809212252.35769.angavrilov@gmail.com>
Alexander Gavrilov schrieb:
Show 6 quoted lines
> 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.)
Show 13 quoted lines
> +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).
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
> + }
> +}