mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 17:20:22 +00:00
ignore: clear the error when matching a pattern negation
When we discover that we want to keep a negative rule, make sure to clear the error variable, as it we otherwise return whatever was left by the previous loop iteration.
This commit is contained in:
parent
cd3f3c2844
commit
2c57114f11
@ -80,6 +80,7 @@ static int does_negate_rule(int *out, git_vector *rules, git_attr_fnmatch *match
|
|||||||
git_vector_foreach(rules, i, rule) {
|
git_vector_foreach(rules, i, rule) {
|
||||||
if (!(rule->flags & GIT_ATTR_FNMATCH_HASWILD)) {
|
if (!(rule->flags & GIT_ATTR_FNMATCH_HASWILD)) {
|
||||||
if (does_negate_pattern(rule, match)) {
|
if (does_negate_pattern(rule, match)) {
|
||||||
|
error = 0;
|
||||||
*out = 1;
|
*out = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1010,3 +1010,15 @@ void test_status_ignore__subdir_doesnt_match_above(void)
|
|||||||
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/SRC/test.txt"));
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, "src/SRC/test.txt"));
|
||||||
cl_assert_equal_i(icase, ignored);
|
cl_assert_equal_i(icase, ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_status_ignore__negate_exact_previous(void)
|
||||||
|
{
|
||||||
|
int ignored;
|
||||||
|
|
||||||
|
g_repo = cl_git_sandbox_init("empty_standard_repo");
|
||||||
|
|
||||||
|
cl_git_mkfile("empty_standard_repo/.gitignore", "*.com\ntags\n!tags/\n.buildpath");
|
||||||
|
cl_git_mkfile("empty_standard_repo/.buildpath", "");
|
||||||
|
cl_git_pass(git_ignore_path_is_ignored(&ignored, g_repo, ".buildpath"));
|
||||||
|
cl_assert_equal_i(1, ignored);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user