From 269427b2bb17684fafc70ddcfa2e6ef8637c8e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Thu, 23 Oct 2025 13:58:57 +0200 Subject: [PATCH] test: check the correct filesystem for case-sensitivity It's certainly possible for the root filesystem to be case-sensitive while /tmp is not, or vice versa. One example where this might happen is when running Docker containers (like ci/docker/fedora) on macOS with the repository checkout on AppleFS (not case sensitive) while the container's /tmp is case sensitive. This fix allows the test to pass under those circumstances as well. --- tests/libgit2/iterator/index.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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);