@@ -270,13 +270,15 @@ impl BackgroundTraversal {
270270
271271 let mut file_size = 0u128 ;
272272 let mut mtime: SystemTime = UNIX_EPOCH ;
273+ let mut file_count = 0u64 ;
273274 match & entry. client_state {
274275 Some ( Ok ( ref m) ) => {
275276 if !m. is_dir ( )
276277 && ( self . walk_options . count_hard_links || self . inodes . add ( m) )
277278 && ( self . walk_options . cross_filesystems
278279 || crossdev:: is_same_device ( device_id, m) )
279280 {
281+ file_count = 1 ;
280282 if self . walk_options . apparent_size {
281283 file_size = m. len ( ) as u128 ;
282284 } else {
@@ -316,7 +318,7 @@ impl BackgroundTraversal {
316318 . push ( self . current_directory_at_depth ) ;
317319 self . current_directory_at_depth = EntryInfo {
318320 size : file_size,
319- entries_count : Some ( 1 ) ,
321+ entries_count : Some ( file_count ) ,
320322 } ;
321323 self . parent_node_idx = self . previous_node_idx ;
322324 }
@@ -340,7 +342,7 @@ impl BackgroundTraversal {
340342 * self
341343 . current_directory_at_depth
342344 . entries_count
343- . get_or_insert ( 0 ) += 1 ;
345+ . get_or_insert ( 0 ) += file_count ;
344346 set_entry_info_or_panic (
345347 & mut traversal. tree ,
346348 self . parent_node_idx ,
@@ -352,7 +354,7 @@ impl BackgroundTraversal {
352354 * self
353355 . current_directory_at_depth
354356 . entries_count
355- . get_or_insert ( 0 ) += 1 ;
357+ . get_or_insert ( 0 ) += file_count ;
356358 }
357359 } ;
358360
0 commit comments