@@ -718,3 +718,64 @@ void test_status_renames__precomposed_unicode_toggle_is_rename(void)
718718#endif
719719}
720720
721+ void test_status_renames__case_insensitive_h2i_and_i2wc (void )
722+ {
723+ git_status_list * statuslist ;
724+ git_status_options opts = GIT_STATUS_OPTIONS_INIT ;
725+ git_reference * head , * test_branch ;
726+ git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT ;
727+ git_str path_to_delete = GIT_STR_INIT ;
728+ git_str path_to_edit = GIT_STR_INIT ;
729+ git_index * index ;
730+ git_strarray paths = { NULL , 0 };
731+
732+ struct status_entry expected [] = {
733+ { GIT_STATUS_INDEX_RENAMED | GIT_STATUS_WT_MODIFIED , "sixserving.txt" , "sixserving-renamed.txt" },
734+ { GIT_STATUS_INDEX_DELETED , "Wow.txt" , "Wow.txt" }
735+ };
736+
737+
738+ // Checkout the correct branch
739+ checkout_opts .checkout_strategy = GIT_CHECKOUT_FORCE ;
740+ cl_git_pass (git_reference_lookup (& head , g_repo , "HEAD" ));
741+ cl_git_pass (git_reference_symbolic_set_target (
742+ & test_branch , head , "refs/heads/case-insensitive-status" , NULL ));
743+ cl_git_pass (git_checkout_head (g_repo , & checkout_opts ));
744+
745+ cl_git_pass (git_repository_index (& index , g_repo ));
746+
747+
748+ // Rename sixserving.txt, delete Wow.txt, and stage those changes
749+ rename_file (g_repo , "sixserving.txt" , "sixserving-renamed.txt" );
750+ cl_git_pass (git_str_joinpath (
751+ & path_to_delete , git_repository_workdir (g_repo ), "Wow.txt" ));
752+ cl_git_rmfile (path_to_delete .ptr );
753+
754+ cl_git_pass (git_index_add_all (index , & paths , GIT_INDEX_ADD_FORCE , NULL , NULL ));
755+ cl_git_pass (git_index_write (index ));
756+
757+
758+ // Change content of sixserving-renamed.txt
759+ cl_git_pass (git_str_joinpath (
760+ & path_to_edit , git_repository_workdir (g_repo ), "sixserving-renamed.txt" ));
761+ cl_git_append2file (path_to_edit .ptr , "New content\n" );
762+
763+
764+ // Run status
765+ opts .flags |= GIT_STATUS_OPT_INCLUDE_UNTRACKED ;
766+ opts .flags |= GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR ;
767+ opts .flags |= GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX ;
768+ opts .flags |= GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY ;
769+
770+ cl_git_pass (git_status_list_new (& statuslist , g_repo , & opts ));
771+ check_status (statuslist , expected , 2 );
772+ git_status_list_free (statuslist );
773+
774+ git_index_free (index );
775+
776+ git_str_dispose (& path_to_delete );
777+ git_str_dispose (& path_to_edit );
778+
779+ git_reference_free (head );
780+ git_reference_free (test_branch );
781+ }
0 commit comments