diff options
author | Russell Belfer <rb@github.com> | 2012-04-26 21:51:45 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-04-26 21:51:45 +0400 |
commit | d58336dda873704f8d12a8b78c3191deefa4ec14 (patch) | |
tree | 84137abc698a572015d41975ced985fc0bd77e61 /tests-clar/attr | |
parent | eb3d71a5bcd78cb4840e62194e8998141508af88 (diff) |
Fix leading slash behavior in attrs/ignores
We were not following the git behavior for leading slashes
in path names when matching git ignores and git attribute
file patterns. This should fix issue #638.
Diffstat (limited to 'tests-clar/attr')
-rw-r--r-- | tests-clar/attr/lookup.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests-clar/attr/lookup.c b/tests-clar/attr/lookup.c index accd617e6..81a4a55d3 100644 --- a/tests-clar/attr/lookup.c +++ b/tests-clar/attr/lookup.c @@ -25,6 +25,7 @@ void test_attr_lookup__simple(void) cl_git_pass(git_attr_file__lookup_one(file,&path,"missing",&value)); cl_assert(!value); + git_attr_path__free(&path); git_attr_file__free(file); } @@ -45,6 +46,8 @@ static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int cl_git_pass(error); attr_check_expected(c->expected, c->expected_str, value); + + git_attr_path__free(&path); } } @@ -83,7 +86,7 @@ void test_attr_lookup__match_variants(void) { "/not/pat2/yousee", "attr2", EXPECT_UNDEFINED, NULL }, /* path match */ { "pat3file", "attr3", EXPECT_UNDEFINED, NULL }, - { "/pat3dir/pat3file", "attr3", EXPECT_UNDEFINED, NULL }, + { "/pat3dir/pat3file", "attr3", EXPECT_TRUE, NULL }, { "pat3dir/pat3file", "attr3", EXPECT_TRUE, NULL }, /* pattern* match */ { "pat4.txt", "attr4", EXPECT_TRUE, NULL }, @@ -101,7 +104,7 @@ void test_attr_lookup__match_variants(void) { "pat6/pat6/.pat6", "attr6", EXPECT_TRUE, NULL }, { "pat6/pat6/extra/foobar.pat6", "attr6", EXPECT_UNDEFINED, NULL }, { "/prefix/pat6/pat6/foobar.pat6", "attr6", EXPECT_UNDEFINED, NULL }, - { "/pat6/pat6/foobar.pat6", "attr6", EXPECT_UNDEFINED, NULL }, + { "/pat6/pat6/foobar.pat6", "attr6", EXPECT_TRUE, NULL }, /* complex pattern */ { "pat7a12z", "attr7", EXPECT_TRUE, NULL }, { "pat7e__x", "attr7", EXPECT_TRUE, NULL }, @@ -139,6 +142,7 @@ void test_attr_lookup__match_variants(void) run_test_cases(file, dir_cases, 1); git_attr_file__free(file); + git_attr_path__free(&path); } void test_attr_lookup__assign_variants(void) |