File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 4
4
//! along with runtime costs for maintaining a global [`rayon`](https://docs.rs/rayon) thread pool.
5
5
//!
6
6
//! 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.
9
8
10
9
#[ cfg( feature = "walkdir" ) ]
11
10
mod shared {
@@ -221,8 +220,22 @@ pub mod walkdir {
221
220
inner : WalkDirImpl :: new ( root)
222
221
. sort_by ( |a, b| {
223
222
// 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 ( ) ) ;
223
+ let storage_a;
224
+ let storage_b;
225
+ let a_name = match gix_path:: os_str_into_bstr ( a. file_name ( ) ) {
226
+ Ok ( f) => f,
227
+ Err ( _) => {
228
+ storage_a = a. file_name ( ) . to_string_lossy ( ) ;
229
+ storage_a. as_ref ( ) . into ( )
230
+ }
231
+ } ;
232
+ let b_name = match gix_path:: os_str_into_bstr ( b. file_name ( ) ) {
233
+ Ok ( f) => f,
234
+ Err ( _) => {
235
+ storage_b = b. file_name ( ) . to_string_lossy ( ) ;
236
+ storage_b. as_ref ( ) . into ( )
237
+ }
238
+ } ;
226
239
// "common." < "common/" < "common0"
227
240
let common = a_name. len ( ) . min ( b_name. len ( ) ) ;
228
241
a_name[ ..common] . cmp ( & b_name[ ..common] ) . then_with ( || {
You can’t perform that action at this time.
0 commit comments