mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-23 19:30:28 +00:00
ignore: add failing test for a file mentioning the parent
When we mention "src" in src/.gitignore, we wrongly consider src/ itself to be ignored.
This commit is contained in:
parent
b4e5432ff0
commit
0798b01400
@ -915,3 +915,35 @@ void test_status_ignore__filename_with_cr(void)
|
|||||||
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "Icon"));
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "Icon"));
|
||||||
cl_assert_equal_i(1, ignored);
|
cl_assert_equal_i(1, ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_status_ignore__subdir_doesnt_match_above(void)
|
||||||
|
{
|
||||||
|
int ignored, icase = 0, error;
|
||||||
|
git_config *cfg;
|
||||||
|
|
||||||
|
g_repo = cl_git_sandbox_init("empty_standard_repo");
|
||||||
|
|
||||||
|
cl_git_pass(git_repository_config_snapshot(&cfg, g_repo));
|
||||||
|
error = git_config_get_bool(&icase, cfg, "core.ignorecase");
|
||||||
|
if (error == GIT_ENOTFOUND)
|
||||||
|
error = 0;
|
||||||
|
|
||||||
|
cl_git_pass(error);
|
||||||
|
|
||||||
|
cl_git_pass(p_mkdir("empty_standard_repo/src", 0777));
|
||||||
|
cl_git_pass(p_mkdir("empty_standard_repo/src/src", 0777));
|
||||||
|
cl_git_mkfile("empty_standard_repo/src/.gitignore", "src\n");
|
||||||
|
cl_git_mkfile("empty_standard_repo/.gitignore", "");
|
||||||
|
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/test.txt"));
|
||||||
|
cl_assert_equal_i(0, ignored);
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/src/test.txt"));
|
||||||
|
cl_assert_equal_i(1, ignored);
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/foo/test.txt"));
|
||||||
|
cl_assert_equal_i(0, ignored);
|
||||||
|
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "SRC/src/test.txt"));
|
||||||
|
cl_assert_equal_i(icase, ignored);
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/SRC/test.txt"));
|
||||||
|
cl_assert_equal_i(icase, ignored);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user