summaryrefslogtreecommitdiff
path: root/tests/attr
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-17 11:53:13 -0700
committerRussell Belfer <rb@github.com>2014-04-17 15:04:41 -0700
commit823c0e9cc142529912976f2e6abff3db456cb204 (patch)
treec07051b17bfcff2ef3edc24da05a8bb5ed6616e1 /tests/attr
parente6e8530aa6c8773dd523fd6fe07629b9481a8fee (diff)
downloadlibgit2-823c0e9cc142529912976f2e6abff3db456cb204.tar.gz
Fix broken logic for attr cache invalidation
The checks to see if files were out of date in the attibute cache was wrong because the cache-breaker data wasn't getting stored correctly. Additionally, when the cache-breaker triggered, the old file data was being leaked.
Diffstat (limited to 'tests/attr')
-rw-r--r--tests/attr/file.c8
-rw-r--r--tests/attr/lookup.c6
-rw-r--r--tests/attr/repo.c9
3 files changed, 13 insertions, 10 deletions
diff --git a/tests/attr/file.c b/tests/attr/file.c
index e35957b51..1f4108c3c 100644
--- a/tests/attr/file.c
+++ b/tests/attr/file.c
@@ -13,7 +13,7 @@ void test_attr_file__simple_read(void)
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr0")));
- cl_assert_equal_s(cl_fixture("attr/attr0"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr0"), file->entry->path);
cl_assert(file->rules.length == 1);
rule = get_rule(0);
@@ -39,7 +39,7 @@ void test_attr_file__match_variants(void)
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr1")));
- cl_assert_equal_s(cl_fixture("attr/attr1"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr1"), file->entry->path);
cl_assert(file->rules.length == 10);
/* let's do a thorough check of this rule, then just verify
@@ -123,7 +123,7 @@ void test_attr_file__assign_variants(void)
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr2")));
- cl_assert_equal_s(cl_fixture("attr/attr2"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr2"), file->entry->path);
cl_assert(file->rules.length == 11);
check_one_assign(file, 0, 0, "pat0", "simple", EXPECT_TRUE, NULL);
@@ -188,7 +188,7 @@ void test_attr_file__check_attr_examples(void)
git_attr_assignment *assign;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr3")));
- cl_assert_equal_s(cl_fixture("attr/attr3"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr3"), file->entry->path);
cl_assert(file->rules.length == 3);
rule = get_rule(0);
diff --git a/tests/attr/lookup.c b/tests/attr/lookup.c
index 099597efc..030ea075d 100644
--- a/tests/attr/lookup.c
+++ b/tests/attr/lookup.c
@@ -10,7 +10,7 @@ void test_attr_lookup__simple(void)
const char *value = NULL;
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr0")));
- cl_assert_equal_s(cl_fixture("attr/attr0"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr0"), file->entry->path);
cl_assert(file->rules.length == 1);
cl_git_pass(git_attr_path__init(&path, "test", NULL));
@@ -130,7 +130,7 @@ void test_attr_lookup__match_variants(void)
};
cl_git_pass(git_attr_file__load_standalone(&file, cl_fixture("attr/attr1")));
- cl_assert_equal_s(cl_fixture("attr/attr1"), file->ce->path);
+ cl_assert_equal_s(cl_fixture("attr/attr1"), file->entry->path);
cl_assert(file->rules.length == 10);
cl_git_pass(git_attr_path__init(&path, "/testing/for/pat0", NULL));
@@ -252,7 +252,7 @@ void test_attr_lookup__from_buffer(void)
cl_git_pass(git_attr_file__new(&file, NULL, 0));
- cl_git_pass(git_attr_file__parse_buffer(NULL, file, "a* foo\nabc bar\n* baz", NULL));
+ cl_git_pass(git_attr_file__parse_buffer(NULL, file, "a* foo\nabc bar\n* baz"));
cl_assert(file->rules.length == 3);
diff --git a/tests/attr/repo.c b/tests/attr/repo.c
index 49cccdc5a..71dc7a5b5 100644
--- a/tests/attr/repo.c
+++ b/tests/attr/repo.c
@@ -68,9 +68,12 @@ void test_attr_repo__get_one(void)
attr_check_expected(scan->expected, scan->expected_str, scan->attr, value);
}
- cl_assert(git_attr_cache__is_cached(g_repo, 0, ".git/info/attributes"));
- cl_assert(git_attr_cache__is_cached(g_repo, 0, ".gitattributes"));
- cl_assert(git_attr_cache__is_cached(g_repo, 0, "sub/.gitattributes"));
+ cl_assert(git_attr_cache__is_cached(
+ g_repo, GIT_ATTR_FILE__FROM_FILE, ".git/info/attributes"));
+ cl_assert(git_attr_cache__is_cached(
+ g_repo, GIT_ATTR_FILE__FROM_FILE, ".gitattributes"));
+ cl_assert(git_attr_cache__is_cached(
+ g_repo, GIT_ATTR_FILE__FROM_FILE, "sub/.gitattributes"));
}
void test_attr_repo__get_many(void)