Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-12-05 18:31:14 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2014-12-05 21:43:36 +0300
commite0a97416d417895cb94d519ad0f16942051d302b (patch)
tree083b046bdbcc12ac8dbadb78e34f59e2afb167d0 /tests/status
parentd43c7bd050cd461b13f4b5aa30f14010c5b2b611 (diff)
ignore: adjust test for negating inside a dir
Given top !top/foo in an ignore file, we should not unignore top/foo. This is an implementation detail of the git code leaking, but that's the behaviour we should show. A negation rule can only negate an exact rule it has seen before.
Diffstat (limited to 'tests/status')
-rw-r--r--tests/status/ignore.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/status/ignore.c b/tests/status/ignore.c
index ea4376c1e..a15b11d1d 100644
--- a/tests/status/ignore.c
+++ b/tests/status/ignore.c
@@ -751,13 +751,19 @@ void test_status_ignore__negative_ignores_inside_ignores(void)
static const char *test_files[] = {
"empty_standard_repo/top/mid/btm/tracked",
"empty_standard_repo/top/mid/btm/untracked",
+ "empty_standard_repo/zoo/bar",
+ "empty_standard_repo/zoo/foo/bar",
NULL
};
make_test_data("empty_standard_repo", test_files);
cl_git_mkfile(
"empty_standard_repo/.gitignore",
- "top\n!top/mid/btm\n");
+ "top\n"
+ "!top/mid/btm\n"
+ "zoo/*\n"
+ "!zoo/bar\n"
+ "!zoo/foo/bar\n");
add_one_to_index("top/mid/btm/tracked");
{
@@ -765,13 +771,15 @@ void test_status_ignore__negative_ignores_inside_ignores(void)
status_entry_counts counts;
static const char *files[] = {
".gitignore", "top/mid/btm/tracked", "top/mid/btm/untracked",
+ "zoo/bar", "zoo/foo/bar",
};
static const unsigned int statuses[] = {
- GIT_STATUS_WT_NEW, GIT_STATUS_INDEX_NEW, GIT_STATUS_WT_NEW,
+ GIT_STATUS_WT_NEW, GIT_STATUS_INDEX_NEW, GIT_STATUS_IGNORED,
+ GIT_STATUS_WT_NEW, GIT_STATUS_IGNORED,
};
memset(&counts, 0x0, sizeof(status_entry_counts));
- counts.expected_entry_count = 3;
+ counts.expected_entry_count = 5;
counts.expected_paths = files;
counts.expected_statuses = statuses;
opts.flags = GIT_STATUS_OPT_DEFAULTS |
@@ -785,8 +793,9 @@ void test_status_ignore__negative_ignores_inside_ignores(void)
cl_assert_equal_i(0, counts.wrong_sorted_path);
}
- refute_is_ignored("top/mid/btm/tracked");
- refute_is_ignored("top/mid/btm/untracked");
+ assert_is_ignored("top/mid/btm/tracked");
+ assert_is_ignored("top/mid/btm/untracked");
+ refute_is_ignored("foo/bar");
}
void test_status_ignore__negative_ignores_in_slash_star(void)