status: Add case insensitivity related failing test
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h index 3fcf45a..55c0764 100644 --- a/tests-clar/clar_libgit2.h +++ b/tests-clar/clar_libgit2.h
@@ -5,6 +5,10 @@ #include <git2.h> #include "common.h" +#if (defined(GIT_WIN32) || defined(__APPLE__)) +#define CASE_INSENSITIVE_FILESYSTEM 1 +#endif + /** * Replace for `clar_must_pass` that passes the last library error as the * test failure message.
diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c index 8cf7379..e0a0f67 100644 --- a/tests-clar/repo/init.c +++ b/tests-clar/repo/init.c
@@ -223,8 +223,6 @@ #endif } -#define CASE_INSENSITIVE_FILESYSTEM (defined GIT_WIN32 || defined __APPLE__) - void test_repo_init__detect_ignorecase(void) { #if CASE_INSENSITIVE_FILESYSTEM
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index c8940ff..c8fb1c1 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c
@@ -694,6 +694,37 @@ cl_git_fail_with(git_status_file(&status, repo, "NEW_FILE"), GIT_ENOTFOUND); } +void test_status_worktree__file_status_honors_case_ignorecase_on_case_insensitive_platforms(void) +{ +#ifdef CASE_INSENSITIVE_FILESYSTEM + git_repository *repo = cl_git_sandbox_init("status"); + unsigned int status; + git_index *index; + + cl_repo_set_bool(repo, "core.ignorecase", true); + + repo = cl_git_sandbox_reopen(); + + cl_git_pass(git_status_file(&status, repo, "NEW_FILE")); + cl_assert_equal_i(GIT_STATUS_WT_NEW, status); + + cl_git_pass(git_status_file(&status, repo, "new_file")); + cl_assert_equal_i(GIT_STATUS_WT_NEW, status); + + cl_git_pass(git_repository_index(&index, repo)); + + cl_git_pass(git_index_add_bypath(index, "new_file")); + cl_git_pass(git_index_write(index)); + git_index_free(index); + + cl_git_pass(git_status_file(&status, repo, "new_file")); + cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); + + cl_git_pass(git_status_file(&status, repo, "NEW_FILE")); + cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); +#endif +} + void test_status_worktree__simple_delete(void) { git_repository *repo = cl_git_sandbox_init("renames");