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:
authorRussell Belfer <rb@github.com>2013-09-10 03:57:34 +0400
committerRussell Belfer <rb@github.com>2013-09-17 20:31:44 +0400
commit974774c7b00c08585b05ff87174872be005a1f29 (patch)
treecea2a1d9b29a4601b90fe23a47775eb39773dcb5 /tests-clar/attr
parent570ba25cb0f757f993e06df629faced32fdf2f8f (diff)
Add attributes to filters and fix registry
The filter registry as implemented was too primitive to actually work once multiple filters were coming into play. This expands the implementation of the registry to handle multiple prioritized filters correctly. Additionally, this adds an "attributes" field to a filter that makes it really really easy to implement filters that are based on one or more attribute values. The lookup and even simple value checking can all happen automatically without custom filter code. Lastly, with the registry improvements, this fills out the filter lifecycle callbacks, with initialize and shutdown callbacks that will be called before the filter is first used and after it is last invoked. This allows for system-wide initialization and cleanup by the filter.
Diffstat (limited to 'tests-clar/attr')
-rw-r--r--tests-clar/attr/repo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests-clar/attr/repo.c b/tests-clar/attr/repo.c
index ca3e71e7f..ef2ad5ce9 100644
--- a/tests-clar/attr/repo.c
+++ b/tests-clar/attr/repo.c
@@ -100,6 +100,22 @@ void test_attr_repo__get_many(void)
cl_assert_equal_s("yes", values[3]);
}
+void test_attr_repo__get_many_in_place(void)
+{
+ const char *vals[4] = { "repoattr", "rootattr", "missingattr", "subattr" };
+
+ /* it should be legal to look up values into the same array that has
+ * the attribute names, overwriting each name as the value is found.
+ */
+
+ cl_git_pass(git_attr_get_many(vals, g_repo, 0, "sub/subdir_test1", 4, vals));
+
+ cl_assert(GIT_ATTR_TRUE(vals[0]));
+ cl_assert(GIT_ATTR_TRUE(vals[1]));
+ cl_assert(GIT_ATTR_UNSPECIFIED(vals[2]));
+ cl_assert_equal_s("yes", vals[3]);
+}
+
static int count_attrs(
const char *name,
const char *value,