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-11 03:33:32 +0400
committerRussell Belfer <rb@github.com>2013-09-17 20:31:44 +0400
commit2a7d224f99a053d93079644947d04e7cc085930f (patch)
tree5a9082e68e98cd85e0bde8d8e399d386158ad390 /tests-clar/object
parent974774c7b00c08585b05ff87174872be005a1f29 (diff)
Extend public filter api with filter lists
This moves the git_filter_list into the public API so that users can create, apply, and dispose of filter lists. This allows more granular application of filters to user data outside of libgit2 internals. This also converts all the internal usage of filters to the public APIs along with a few small tweaks to make it easier to use the public git_buffer stuff alongside the internal git_buf.
Diffstat (limited to 'tests-clar/object')
-rw-r--r--tests-clar/object/blob/filter.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests-clar/object/blob/filter.c b/tests-clar/object/blob/filter.c
index 33ebedcde..a23f897f9 100644
--- a/tests-clar/object/blob/filter.c
+++ b/tests-clar/object/blob/filter.c
@@ -1,7 +1,6 @@
#include "clar_libgit2.h"
#include "posix.h"
#include "blob.h"
-#include "filter.h"
#include "buf_text.h"
static git_repository *g_repo = NULL;
@@ -105,7 +104,7 @@ void test_object_blob_filter__to_odb(void)
git_config *cfg;
int i;
git_blob *blob;
- git_buf orig = GIT_BUF_INIT, out = GIT_BUF_INIT;
+ git_buffer out = GIT_BUFFER_INIT;
cl_git_pass(git_repository_config(&cfg, g_repo));
cl_assert(cfg);
@@ -119,17 +118,18 @@ void test_object_blob_filter__to_odb(void)
for (i = 0; i < NUM_TEST_OBJECTS; i++) {
cl_git_pass(git_blob_lookup(&blob, g_repo, &g_oids[i]));
- cl_git_pass(git_blob__getbuf(&orig, blob));
- cl_git_pass(git_filter_list_apply(&out, &orig, fl));
- cl_assert(git_buf_cmp(&out, &g_crlf_filtered[i]) == 0);
+ cl_git_pass(git_filter_list_apply_to_blob(&out, fl, blob));
+
+ cl_assert(!memcmp(
+ out.ptr, g_crlf_filtered[i].ptr,
+ min(out.size, g_crlf_filtered[i].size)));
git_blob_free(blob);
}
git_filter_list_free(fl);
- git_buf_free(&orig);
- git_buf_free(&out);
+ git_buffer_free(&out);
git_config_free(cfg);
}