@@ -7,6 +7,15 @@ use crate::common::{TestContext, cmd_snapshot};
77
88mod common;
99
10+ fn is_case_sensitive_filesystem ( context : & TestContext ) -> Result < bool > {
11+ let test_lower = context. work_dir ( ) . child ( "case_test_file.txt" ) ;
12+ test_lower. write_str ( "test" ) ?;
13+ let test_upper = context. work_dir ( ) . child ( "CASE_TEST_FILE.txt" ) ;
14+ let is_sensitive = !test_upper. exists ( ) ;
15+ fs_err:: remove_file ( test_lower. path ( ) ) ?;
16+ Ok ( is_sensitive)
17+ }
18+
1019#[ test]
1120fn end_of_file_fixer_hook ( ) -> Result < ( ) > {
1221 let context = TestContext :: new ( ) ;
@@ -1271,6 +1280,11 @@ fn check_case_conflict_hook() -> Result<()> {
12711280 context. init_project ( ) ;
12721281 context. configure_git_author ( ) ;
12731282
1283+ if !is_case_sensitive_filesystem ( & context) ? {
1284+ // Skipping test on case-insensitive filesystem
1285+ return Ok ( ( ) ) ;
1286+ }
1287+
12741288 // Create initial files and commit
12751289 let cwd = context. work_dir ( ) ;
12761290 cwd. child ( "README.md" ) . write_str ( "Initial commit" ) ?;
@@ -1330,6 +1344,11 @@ fn check_case_conflict_directory() -> Result<()> {
13301344 context. init_project ( ) ;
13311345 context. configure_git_author ( ) ;
13321346
1347+ if !is_case_sensitive_filesystem ( & context) ? {
1348+ // Skipping test on case-insensitive filesystem
1349+ return Ok ( ( ) ) ;
1350+ }
1351+
13331352 // Create directory with file
13341353 let cwd = context. work_dir ( ) ;
13351354 cwd. child ( "src/utils/helper.py" ) . write_str ( "helper" ) ?;
@@ -1370,6 +1389,11 @@ fn check_case_conflict_among_new_files() -> Result<()> {
13701389 context. init_project ( ) ;
13711390 context. configure_git_author ( ) ;
13721391
1392+ if !is_case_sensitive_filesystem ( & context) ? {
1393+ // Skipping test on case-insensitive filesystem
1394+ return Ok ( ( ) ) ;
1395+ }
1396+
13731397 let cwd = context. work_dir ( ) ;
13741398 cwd. child ( "README.md" ) . write_str ( "Initial" ) ?;
13751399 context. git_add ( "." ) ;
0 commit comments