summaryrefslogtreecommitdiff
path: root/tests-clay/attr/file.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-16 16:58:27 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-16 16:58:27 -0800
commita51cd8e6f6724079a552b75e014f792f3f68e158 (patch)
treefcf526f2a7575e215d95589d1a8e07277981fd18 /tests-clay/attr/file.c
parent6e03b12f5715cb3f5cb5c8be6512e041cdf44a05 (diff)
downloadlibgit2-a51cd8e6f6724079a552b75e014f792f3f68e158.tar.gz
Fix handling of relative paths for attrs
Per issue #533, the handling of relative paths in attribute and ignore files was not right. Fixed this by pre-joining the relative path of the attribute/ignore file onto the match string when a full path match is required. Unfortunately, fixing this required a bit more code than I would have liked because I had to juggle things around so that the fnmatch parser would have sufficient information to prepend the relative path when it was needed.
Diffstat (limited to 'tests-clay/attr/file.c')
-rw-r--r--tests-clay/attr/file.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests-clay/attr/file.c b/tests-clay/attr/file.c
index acca0c653..652ee273c 100644
--- a/tests-clay/attr/file.c
+++ b/tests-clay/attr/file.c
@@ -6,11 +6,12 @@
void test_attr_file__simple_read(void)
{
- git_attr_file *file = NULL;
+ git_attr_file *file;
git_attr_assignment *assign;
git_attr_rule *rule;
- cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr0"), &file));
+ cl_git_pass(git_attr_file__new(&file));
+ cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr0"), file));
cl_assert_strequal(cl_fixture("attr/attr0"), file->path);
cl_assert(file->rules.length == 1);
@@ -32,11 +33,12 @@ void test_attr_file__simple_read(void)
void test_attr_file__match_variants(void)
{
- git_attr_file *file = NULL;
+ git_attr_file *file;
git_attr_rule *rule;
git_attr_assignment *assign;
- cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr1"), &file));
+ cl_git_pass(git_attr_file__new(&file));
+ cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr1"), file));
cl_assert_strequal(cl_fixture("attr/attr1"), file->path);
cl_assert(file->rules.length == 10);
@@ -119,11 +121,12 @@ static void check_one_assign(
void test_attr_file__assign_variants(void)
{
- git_attr_file *file = NULL;
+ git_attr_file *file;
git_attr_rule *rule;
git_attr_assignment *assign;
- cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr2"), &file));
+ cl_git_pass(git_attr_file__new(&file));
+ cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr2"), file));
cl_assert_strequal(cl_fixture("attr/attr2"), file->path);
cl_assert(file->rules.length == 11);
@@ -184,11 +187,12 @@ void test_attr_file__assign_variants(void)
void test_attr_file__check_attr_examples(void)
{
- git_attr_file *file = NULL;
+ git_attr_file *file;
git_attr_rule *rule;
git_attr_assignment *assign;
- cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr3"), &file));
+ cl_git_pass(git_attr_file__new(&file));
+ cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr3"), file));
cl_assert_strequal(cl_fixture("attr/attr3"), file->path);
cl_assert(file->rules.length == 3);