File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 44//! along with runtime costs for maintaining a global [`rayon`](https://docs.rs/rayon) thread pool.
55//!
66//! For information on how to use the [`WalkDir`] type, have a look at
7- //! * [`jwalk::WalkDir`](https://docs.rs/jwalk/0.5.1/jwalk/type.WalkDir.html) if `parallel` feature is enabled
8- //! * [walkdir::WalkDir](https://docs.rs/walkdir/2.3.1/walkdir/struct.WalkDir.html) otherwise
7+ // TODO: Move all this to `gix-fs` in a breaking change.
98
109#[ cfg( feature = "walkdir" ) ]
1110mod shared {
@@ -220,9 +219,22 @@ pub mod walkdir {
220219 WalkDir {
221220 inner : WalkDirImpl :: new ( root)
222221 . sort_by ( |a, b| {
223- // Ignore non-utf8 file name on Windows, which would probably be rejected by caller.
224- let a_name = gix_path:: os_str_into_bstr ( a. file_name ( ) ) . unwrap_or ( "" . as_ref ( ) ) ;
225- let b_name = gix_path:: os_str_into_bstr ( b. file_name ( ) ) . unwrap_or ( "" . as_ref ( ) ) ;
222+ let storage_a;
223+ let storage_b;
224+ let a_name = match gix_path:: os_str_into_bstr ( a. file_name ( ) ) {
225+ Ok ( f) => f,
226+ Err ( _) => {
227+ storage_a = a. file_name ( ) . to_string_lossy ( ) ;
228+ storage_a. as_ref ( ) . into ( )
229+ }
230+ } ;
231+ let b_name = match gix_path:: os_str_into_bstr ( b. file_name ( ) ) {
232+ Ok ( f) => f,
233+ Err ( _) => {
234+ storage_b = b. file_name ( ) . to_string_lossy ( ) ;
235+ storage_b. as_ref ( ) . into ( )
236+ }
237+ } ;
226238 // "common." < "common/" < "common0"
227239 let common = a_name. len ( ) . min ( b_name. len ( ) ) ;
228240 a_name[ ..common] . cmp ( & b_name[ ..common] ) . then_with ( || {
You can’t perform that action at this time.
0 commit comments