File tree Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Expand file tree Collapse file tree 1 file changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -144,24 +144,28 @@ Main {
144144 option ( :verbose )
145145
146146 def run
147- $params = params
148- seen = Set . new
149- dirs = $params[ :dir ] . values * ' '
150-
151- # This command relies on GNU find's -printf directive
152- IO . popen "find -H -L #{ dirs } -name .git -printf '%p\\ n\\ c'" do |io |
153- while path = io . gets
154- next if seen . include? path # never process the same path twice
155- seen << path
156-
157- begin
158- GitUpdate . report File . dirname ( path )
159- rescue => ex
160- GitUpdate . top_ten ( 'FAILED' , path , [ ex . message ] + ex . backtrace ,
161- false , '#' )
162- end
163- STDOUT . flush
147+ $params = params
148+ seen = Set . new
149+ dirs = $params[ :dir ] . values * ' '
150+ # Relies on GNU find's -printf directive
151+ find_cmd = "find -H -L #{ dirs } -name .git -printf '%p\\ n\\ c'"
152+
153+ # This asynchronous usage allows the "find" command to continue producing
154+ # pathnames while we work on them. Find.find() would block until all the
155+ # pathnames had been found, which can be very slow (especially on laptop
156+ # hard drives with large filesets).
157+
158+ IO . popen ( find_cmd ) . each do |path |
159+ next if seen . include? path # never process the same path twice
160+ seen << path
161+
162+ begin
163+ GitUpdate . report File . dirname ( path )
164+ rescue => ex
165+ GitUpdate . top_ten ( 'FAILED' , path , [ ex . message ] + ex . backtrace ,
166+ false , '#' )
164167 end
168+ STDOUT . flush
165169 end
166170 end
167171}
You can’t perform that action at this time.
0 commit comments