@@ -816,6 +816,7 @@ pub struct PathData<'a> {
816816 p_buf : Cow < ' a , Path > ,
817817 must_dereference : bool ,
818818 command_line : bool ,
819+ is_dot_dir : bool ,
819820}
820821
821822impl < ' a > PathData < ' a > {
@@ -838,6 +839,7 @@ impl<'a> PathData<'a> {
838839 file_name : Option < Cow < ' a , OsStr > > ,
839840 config : & Config ,
840841 command_line : bool ,
842+ is_dot_dir : bool ,
841843 ) -> Self {
842844 // We cannot use `Path::ends_with` or `Path::Components`, because they remove occurrences of '.'
843845 // For '..', the filename is None
@@ -904,6 +906,7 @@ impl<'a> PathData<'a> {
904906 p_buf,
905907 must_dereference,
906908 command_line,
909+ is_dot_dir,
907910 }
908911 }
909912
@@ -1164,7 +1167,7 @@ pub fn list_with_output<O: LsOutput>(
11641167 let initial_locs_len = locs. len ( ) ;
11651168
11661169 for loc in locs {
1167- let path_data = PathData :: new ( loc. into ( ) , None , None , config, true ) ;
1170+ let path_data = PathData :: new ( loc. into ( ) , None , None , config, true , false ) ;
11681171
11691172 // Getting metadata here is no big deal as it's just the CWD
11701173 // and we really just want to know if the strings exist as files/dirs
@@ -1278,13 +1281,15 @@ fn collect_directory_entries<O: LsOutput>(
12781281 Some ( OsStr :: new ( "." ) . into ( ) ) ,
12791282 config,
12801283 false ,
1284+ true ,
12811285 ) ) ;
12821286 entries. push ( PathData :: new (
12831287 dotdot_path ( path_data. path ( ) ) . into ( ) ,
12841288 None ,
12851289 Some ( OsStr :: new ( ".." ) . into ( ) ) ,
12861290 config,
12871291 false ,
1292+ true ,
12881293 ) ) ;
12891294 }
12901295
@@ -1305,6 +1310,7 @@ fn collect_directory_entries<O: LsOutput>(
13051310 None ,
13061311 config,
13071312 false ,
1313+ false ,
13081314 ) ) ;
13091315 }
13101316 }
@@ -1375,6 +1381,7 @@ fn enter_directory<O: LsOutput>(
13751381 None ,
13761382 config,
13771383 entry. command_line ,
1384+ false ,
13781385 ) ;
13791386
13801387 if !entry. is_first {
@@ -1404,12 +1411,9 @@ fn enter_directory<O: LsOutput>(
14041411 write_directory_entries ( entries, config, output) ?;
14051412
14061413 if config. recursive {
1407- let start = if config. files == Files :: All { 2 } else { 0 } ;
1408-
14091414 for child in entries
14101415 . iter ( )
1411- . skip ( start)
1412- . filter ( |p| p. file_type ( ) . is_some_and ( FileType :: is_dir) )
1416+ . filter ( |p| p. file_type ( ) . is_some_and ( FileType :: is_dir) && !p. is_dot_dir )
14131417 . rev ( )
14141418 {
14151419 let child_path = child. path ( ) . to_path_buf ( ) ;
0 commit comments