@@ -332,10 +332,10 @@ fn no_case_related_collisions_on_case_sensitive_filesystem() {
332
332
}
333
333
334
334
#[ test]
335
- fn collisions_are_detected_on_a_case_sensitive_filesystem ( ) {
335
+ fn collisions_are_detected_on_a_case_insensitive_filesystem ( ) {
336
336
let opts = opts_from_probe ( ) ;
337
337
if !opts. fs . ignore_case {
338
- eprintln ! ( "Skipping case-insensitive testing on what would be a case-senstive file system" ) ;
338
+ eprintln ! ( "Skipping case-insensitive testing on what would be a case-sensitive file system" ) ;
339
339
return ;
340
340
}
341
341
let ( source_tree, destination, _index, outcome) =
@@ -349,44 +349,61 @@ fn collisions_are_detected_on_a_case_sensitive_filesystem() {
349
349
) ;
350
350
351
351
let dest_files = dir_structure ( & destination) ;
352
- assert_eq ! (
353
- stripped_prefix( & destination, & dest_files) ,
354
- paths( [ "D/B" , "D/C" , "FILE_X" , "X" , "link-to-X" ] ) ,
355
- "we checkout files in order and generally handle collision detection differently, hence the difference"
356
- ) ;
352
+ let multi_threaded = git_features:: parallel:: num_threads ( None ) > 1 ;
353
+ if multi_threaded {
354
+ assert_eq ! (
355
+ dest_files. len( ) ,
356
+ 5 ,
357
+ "can only assert on number as it's racily creating files so unclear which one clashes"
358
+ ) ;
359
+ } else {
360
+ assert_eq ! (
361
+ stripped_prefix( & destination, & dest_files) ,
362
+ paths( [ "D/B" , "D/C" , "FILE_X" , "X" , "link-to-X" ] ) ,
363
+ "we checkout files in order and generally handle collision detection differently, hence the difference"
364
+ ) ;
365
+ }
357
366
358
367
let error_kind = ErrorKind :: AlreadyExists ;
359
368
#[ cfg( windows) ]
360
369
let error_kind_dir = ErrorKind :: PermissionDenied ;
361
370
#[ cfg( not( windows) ) ]
362
371
let error_kind_dir = error_kind;
363
372
364
- assert_eq ! (
365
- sort_when_threaded( outcome. collisions) ,
366
- sort_when_threaded( vec![
367
- Collision {
368
- path: "FILE_x" . into( ) ,
369
- error_kind,
370
- } ,
371
- Collision {
372
- path: "d" . into( ) ,
373
- error_kind: error_kind_dir,
374
- } ,
375
- Collision {
376
- path: "file_X" . into( ) ,
377
- error_kind,
378
- } ,
379
- Collision {
380
- path: "file_x" . into( ) ,
381
- error_kind,
382
- } ,
383
- Collision {
384
- path: "x" . into( ) ,
385
- error_kind,
386
- } ,
387
- ] ) ,
388
- "these files couldn't be checked out"
389
- ) ;
373
+ if multi_threaded {
374
+ assert_eq ! (
375
+ outcome. collisions. len( ) ,
376
+ 5 ,
377
+ "can only assert on number as it's racily creating files so unclear which one clashes"
378
+ ) ;
379
+ } else {
380
+ assert_eq ! (
381
+ outcome. collisions,
382
+ vec![
383
+ Collision {
384
+ path: "FILE_x" . into( ) ,
385
+ error_kind,
386
+ } ,
387
+ Collision {
388
+ path: "d" . into( ) ,
389
+ error_kind: error_kind_dir,
390
+ } ,
391
+ Collision {
392
+ path: "file_X" . into( ) ,
393
+ error_kind,
394
+ } ,
395
+ Collision {
396
+ path: "file_x" . into( ) ,
397
+ error_kind,
398
+ } ,
399
+ Collision {
400
+ path: "x" . into( ) ,
401
+ error_kind,
402
+ } ,
403
+ ] ,
404
+ "these files couldn't be checked out"
405
+ ) ;
406
+ }
390
407
}
391
408
392
409
fn assert_equality ( source_tree : & Path , destination : & TempDir , allow_symlinks : bool ) -> crate :: Result < usize > {
0 commit comments