@@ -287,21 +287,27 @@ fn keep_going_collects_results() {
287
287
)
288
288
. unwrap ( ) ;
289
289
290
- assert_eq ! (
291
- sort_when_threaded(
290
+ if multi_threaded ( ) {
291
+ assert_eq ! (
292
+ outcome. errors. len( ) ,
293
+ 2 ,
294
+ "content changes due to non-deterministic nature of racy threads"
295
+ )
296
+ } else {
297
+ assert_eq ! (
292
298
outcome
293
299
. errors
294
300
. iter( )
295
301
. map( |r| r. path. to_path_lossy( ) . into_owned( ) )
296
- . collect( )
297
- ) ,
298
- sort_when_threaded ( paths ( if cfg! ( unix ) {
299
- [ "dir/content" , "empty" ]
300
- } else {
301
- // not actually a symlink anymore, even though symlinks are supported but git think differently.
302
- [ "dir/content" , "dir/sub-dir/symlink" ]
303
- } ) )
304
- ) ;
302
+ . collect:: < Vec <_>> ( ) ,
303
+ paths ( if cfg! ( unix ) {
304
+ [ "dir/content" , "empty" ]
305
+ } else {
306
+ // not actually a symlink anymore, even though symlinks are supported but git think differently.
307
+ [ "dir/content" , "dir/sub-dir/symlink" ]
308
+ } )
309
+ ) ;
310
+ }
305
311
306
312
assert_eq ! (
307
313
stripped_prefix( & destination, & dir_structure( & destination) ) ,
@@ -349,8 +355,7 @@ fn collisions_are_detected_on_a_case_insensitive_filesystem() {
349
355
) ;
350
356
351
357
let dest_files = dir_structure ( & destination) ;
352
- let multi_threaded = git_features:: parallel:: num_threads ( None ) > 1 ;
353
- if multi_threaded {
358
+ if multi_threaded ( ) {
354
359
assert_eq ! (
355
360
dest_files. len( ) ,
356
361
5 ,
@@ -370,7 +375,7 @@ fn collisions_are_detected_on_a_case_insensitive_filesystem() {
370
375
#[ cfg( not( windows) ) ]
371
376
let error_kind_dir = error_kind;
372
377
373
- if multi_threaded {
378
+ if multi_threaded ( ) {
374
379
assert_eq ! (
375
380
outcome. collisions. len( ) ,
376
381
5 ,
@@ -406,6 +411,10 @@ fn collisions_are_detected_on_a_case_insensitive_filesystem() {
406
411
}
407
412
}
408
413
414
+ fn multi_threaded ( ) -> bool {
415
+ git_features:: parallel:: num_threads ( None ) > 1
416
+ }
417
+
409
418
fn assert_equality ( source_tree : & Path , destination : & TempDir , allow_symlinks : bool ) -> crate :: Result < usize > {
410
419
let source_files = dir_structure ( source_tree) ;
411
420
let worktree_files = dir_structure ( & destination) ;
@@ -517,13 +526,3 @@ fn opts_from_probe() -> index::checkout::Options {
517
526
fn paths < ' a > ( p : impl IntoIterator < Item = & ' a str > ) -> Vec < PathBuf > {
518
527
p. into_iter ( ) . map ( PathBuf :: from) . collect ( )
519
528
}
520
-
521
- fn sort_when_threaded < T > ( mut p : Vec < T > ) -> Vec < T >
522
- where
523
- T : Ord ,
524
- {
525
- if git_features:: parallel:: num_threads ( None ) > 1 {
526
- p. sort ( )
527
- }
528
- p
529
- }
0 commit comments