@@ -31,6 +31,10 @@ mod checkout {
31
31
}
32
32
}
33
33
34
+ fn paths < ' a > ( p : impl IntoIterator < Item = & ' a str > ) -> Vec < PathBuf > {
35
+ p. into_iter ( ) . map ( PathBuf :: from) . collect ( )
36
+ }
37
+
34
38
#[ test]
35
39
fn symlinks_become_files_if_disabled ( ) -> crate :: Result {
36
40
let opts = opts_with_symlink ( false ) ;
@@ -76,11 +80,12 @@ mod checkout {
76
80
77
81
#[ test]
78
82
fn collisions_are_detected_on_a_case_sensitive_filesystem ( ) {
79
- if !probe_gitoxide_dir ( ) . unwrap ( ) . ignore_case {
83
+ let fs_caps = probe_gitoxide_dir ( ) . unwrap ( ) ;
84
+ if !fs_caps. ignore_case {
80
85
eprintln ! ( "Skipping case-insensitive testing on what would be a case-senstive file system" ) ;
81
86
return ;
82
87
}
83
- let opts = opts_with_symlink ( true ) ;
88
+ let opts = opts_with_symlink ( fs_caps . symlink ) ;
84
89
let ( source_tree, destination, _index, outcome) =
85
90
checkout_index_in_tmp_dir ( opts, "make_ignorecase_collisions" ) . unwrap ( ) ;
86
91
@@ -109,21 +114,25 @@ mod checkout {
109
114
path: "file_x" . into( ) ,
110
115
error_kind,
111
116
} ,
117
+ Collision {
118
+ path: "x" . into( ) ,
119
+ error_kind,
120
+ } ,
112
121
] ,
113
122
"these files couldn't be checked out"
114
123
) ;
115
124
116
125
let source_files = dir_structure ( & source_tree) ;
117
126
assert_eq ! (
118
127
stripped_prefix( & source_tree, & source_files) ,
119
- vec! [ PathBuf :: from ( "d" ) , PathBuf :: from ( "file_x" ) ] ,
128
+ paths ( [ "d" , "file_x" , "link-to-X" , "x" ] ) ,
120
129
"plenty of collisions prevent a checkout"
121
130
) ;
122
131
123
132
let dest_files = dir_structure ( & destination) ;
124
133
assert_eq ! (
125
134
stripped_prefix( & destination, & dest_files) ,
126
- vec! [ PathBuf :: from ( "D/B" ) , PathBuf :: from ( "D/C" ) , PathBuf :: from ( "FILE_X" ) ] ,
135
+ paths ( [ "D/B" , "D/C" , "FILE_X" , "X" , "link-to-X" ] ) ,
127
136
"we checkout files in order and generally handle collision detection differently, hence the difference"
128
137
) ;
129
138
}
0 commit comments