@@ -781,3 +781,65 @@ void test_status_renames__rename_threshold(void)
781781
782782 git_index_free (index );
783783}
784+
785+ void test_status_renames__case_insensitive_h2i_and_i2wc (void )
786+ {
787+ git_status_list * statuslist ;
788+ git_status_options opts = GIT_STATUS_OPTIONS_INIT ;
789+ git_reference * head , * test_branch ;
790+ git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT ;
791+ git_str path_to_delete = GIT_STR_INIT ;
792+ git_str path_to_edit = GIT_STR_INIT ;
793+ git_index * index ;
794+ git_strarray paths = { NULL , 0 };
795+
796+ struct status_entry expected [] = {
797+ { GIT_STATUS_INDEX_RENAMED | GIT_STATUS_WT_MODIFIED , "sixserving.txt" , "sixserving-renamed.txt" },
798+ { GIT_STATUS_INDEX_DELETED , "Wow.txt" , "Wow.txt" }
799+ };
800+
801+
802+ // Checkout the correct branch
803+ checkout_opts .checkout_strategy = GIT_CHECKOUT_FORCE ;
804+ cl_git_pass (git_reference_lookup (& head , g_repo , "HEAD" ));
805+ cl_git_pass (git_reference_symbolic_set_target (
806+ & test_branch , head , "refs/heads/case-insensitive-status" , NULL ));
807+ cl_git_pass (git_checkout_head (g_repo , & checkout_opts ));
808+
809+ cl_git_pass (git_repository_index (& index , g_repo ));
810+
811+
812+ // Rename sixserving.txt, delete Wow.txt, and stage those changes
813+ rename_file (g_repo , "sixserving.txt" , "sixserving-renamed.txt" );
814+ cl_git_pass (git_str_joinpath (
815+ & path_to_delete , git_repository_workdir (g_repo ), "Wow.txt" ));
816+ cl_git_rmfile (path_to_delete .ptr );
817+
818+ cl_git_pass (git_index_add_all (index , & paths , GIT_INDEX_ADD_FORCE , NULL , NULL ));
819+ cl_git_pass (git_index_write (index ));
820+
821+
822+ // Change content of sixserving-renamed.txt
823+ cl_git_pass (git_str_joinpath (
824+ & path_to_edit , git_repository_workdir (g_repo ), "sixserving-renamed.txt" ));
825+ cl_git_append2file (path_to_edit .ptr , "New content\n" );
826+
827+
828+ // Run status
829+ opts .flags |= GIT_STATUS_OPT_INCLUDE_UNTRACKED ;
830+ opts .flags |= GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR ;
831+ opts .flags |= GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX ;
832+ opts .flags |= GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY ;
833+
834+ cl_git_pass (git_status_list_new (& statuslist , g_repo , & opts ));
835+ check_status (statuslist , expected , 2 );
836+ git_status_list_free (statuslist );
837+
838+ git_index_free (index );
839+
840+ git_str_dispose (& path_to_delete );
841+ git_str_dispose (& path_to_edit );
842+
843+ git_reference_free (head );
844+ git_reference_free (test_branch );
845+ }
0 commit comments