- 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 :]
- 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]]
- }
- regsub {^ } $value {} value
- set path_attr_cache($attr,$path) $value
- }
+ global path_attr_cache
+ set newlist {}
+ foreach path $pathlist {
+ if {![info exists path_attr_cache($attr,$path)]} {
+ lappend newlist $path
+ }
+ }
+ set lim 1000
+ if {[tk windowingsystem] == "win32"} {
+ # windows has a 32k limit on the arguments to a command...
+ set lim 30
+ }
+ while {$newlist ne {}} {
+ set head [lrange $newlist 0 [expr {$lim - 1}]]
+ set newlist [lrange $newlist $lim end]
+ if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {
+ foreach row [split $rlist "\n"] {
+ if {[regexp "(.*): encoding: (.*)" $row m path value]} {
+ if {[string index $path 0] eq "\""} {
+ set path [encoding convertfrom [lindex $path 0]]
+ }
+ set path_attr_cache($attr,$path) $value