summaryrefslogtreecommitdiff
path: root/tests/status
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-05-20 21:18:25 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-20 21:49:02 +0200
commit2c57114f1117ea94e3023d989018748be76d52eb (patch)
treefcb846a88b016e193a9316af5d3988d4238920a6 /tests/status
parentcd3f3c2844715b12583eb4d4a6129d3050f115a4 (diff)
downloadlibgit2-2c57114f1117ea94e3023d989018748be76d52eb.tar.gz
ignore: clear the error when matching a pattern negationcmn/ignored-ignore
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.
Diffstat (limited to 'tests/status')
-rw-r--r--tests/status/ignore.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/status/ignore.c b/tests/status/ignore.c
index 3193d318e..ba1d69a99 100644
--- a/tests/status/ignore.c
+++ b/tests/status/ignore.c
@@ -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_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);
+}