@@ -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 ( ) ;
@@ -765,6 +774,11 @@ fn check_case_conflict_hook() -> Result<()> {
765774 context. init_project ( ) ;
766775 context. configure_git_author ( ) ;
767776
777+ if !is_case_sensitive_filesystem ( & context) ? {
778+ eprintln ! ( "Skipping test on case-insensitive filesystem" ) ;
779+ return Ok ( ( ) ) ;
780+ }
781+
768782 // Create initial files and commit
769783 let cwd = context. work_dir ( ) ;
770784 cwd. child ( "README.md" ) . write_str ( "Initial commit" ) ?;
@@ -824,6 +838,11 @@ fn check_case_conflict_directory() -> Result<()> {
824838 context. init_project ( ) ;
825839 context. configure_git_author ( ) ;
826840
841+ if !is_case_sensitive_filesystem ( & context) ? {
842+ eprintln ! ( "Skipping test on case-insensitive filesystem" ) ;
843+ return Ok ( ( ) ) ;
844+ }
845+
827846 // Create directory with file
828847 let cwd = context. work_dir ( ) ;
829848 cwd. child ( "src/utils/helper.py" ) . write_str ( "helper" ) ?;
@@ -864,6 +883,11 @@ fn check_case_conflict_among_new_files() -> Result<()> {
864883 context. init_project ( ) ;
865884 context. configure_git_author ( ) ;
866885
886+ if !is_case_sensitive_filesystem ( & context) ? {
887+ eprintln ! ( "Skipping test on case-insensitive filesystem" ) ;
888+ return Ok ( ( ) ) ;
889+ }
890+
867891 let cwd = context. work_dir ( ) ;
868892 cwd. child ( "README.md" ) . write_str ( "Initial" ) ?;
869893 context. git_add ( "." ) ;
0 commit comments