diff options
author | Jason Haslam <jason@scitools.com> | 2015-07-16 10:17:16 -0600 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-11-02 16:33:58 -0500 |
commit | 3138ad936682addd191913c42946aae431b4eece (patch) | |
tree | abfb79a660933fb5ad68f3fdcd812fe9d0e61958 /tests/diff | |
parent | db1edf91e9ba9e82e6534c445008703766b5a6da (diff) | |
download | libgit2-3138ad936682addd191913c42946aae431b4eece.tar.gz |
Add diff progress callback.
Diffstat (limited to 'tests/diff')
-rw-r--r-- | tests/diff/notify.c | 29 | ||||
-rw-r--r-- | tests/diff/tree.c | 2 |
2 files changed, 29 insertions, 2 deletions
diff --git a/tests/diff/notify.c b/tests/diff/notify.c index 6ef4af573..74abbc93b 100644 --- a/tests/diff/notify.c +++ b/tests/diff/notify.c @@ -55,7 +55,7 @@ static void test_notify( opts.pathspec.strings = searched_pathspecs; opts.pathspec.count = pathspecs_count; - opts.notify_payload = expected_matched_pathspecs; + opts.payload = expected_matched_pathspecs; memset(&exp, 0, sizeof(exp)); cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts)); @@ -228,3 +228,30 @@ void test_diff_notify__notify_cb_can_be_used_as_filtering_function(void) git_diff_free(diff); } + +static int progress_abort_diff( + const git_diff *diff_so_far, + const char *old_path, + const char *new_path, + void *payload) +{ + GIT_UNUSED(old_path); + GIT_UNUSED(new_path); + GIT_UNUSED(payload); + + return -42; +} + +void test_diff_notify__progress_cb_can_abort_diff(void) +{ + git_diff_options opts = GIT_DIFF_OPTIONS_INIT; + git_diff *diff = NULL; + + g_repo = cl_git_sandbox_init("status"); + + opts.flags |= GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_INCLUDE_UNTRACKED; + opts.progress_cb = progress_abort_diff; + + cl_git_fail_with( + git_diff_index_to_workdir(&diff, g_repo, NULL, &opts), -42); +} diff --git a/tests/diff/tree.c b/tests/diff/tree.c index 2bc9e6a55..e4b2a8bbe 100644 --- a/tests/diff/tree.c +++ b/tests/diff/tree.c @@ -90,7 +90,7 @@ void test_diff_tree__0(void) #define DIFF_OPTS(FLAGS, CTXT) \ {GIT_DIFF_OPTIONS_VERSION, (FLAGS), GIT_SUBMODULE_IGNORE_UNSPECIFIED, \ - {NULL,0}, NULL, NULL, (CTXT), 1} + {NULL,0}, NULL, NULL, NULL, (CTXT), 1} void test_diff_tree__options(void) { |