diff --git a/tests/libgit2/iterator/index.c b/tests/libgit2/iterator/index.c index 2f50bfab0..4e11996eb 100644 --- a/tests/libgit2/iterator/index.c +++ b/tests/libgit2/iterator/index.c @@ -280,12 +280,24 @@ static const char *expected_index_ci[] = { void test_iterator_index__case_folding(void) { git_str path = GIT_STR_INIT; + git_index *index; int fs_is_ci = 0; + int index_is_ci = 0; - cl_git_pass(git_str_joinpath(&path, cl_fixture("icase"), ".gitted/CoNfIg")); + g_repo = cl_git_sandbox_init("icase"); + + /* check filesystem case-sensitivity in the sandbox where tests will be executing */ + cl_git_pass(git_str_joinpath(&path, git_repository_workdir(g_repo), ".git/CoNfIg")); fs_is_ci = git_fs_path_exists(path.ptr); git_str_dispose(&path); + /* verify index capability matches filesystem detection */ + cl_git_pass(git_repository_index(&index, g_repo)); + index_is_ci = (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0; + cl_assert_equal_i(fs_is_ci, index_is_ci); + git_index_free(index); + cl_git_sandbox_cleanup(); + index_iterator_test( "icase", NULL, NULL, 0, ARRAY_SIZE(expected_index_cs), fs_is_ci ? expected_index_ci : expected_index_cs, NULL);