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));
- cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, &exp));
+ cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, NULL, &exp));
cl_assert_equal_i(expected_diffed_files_count, exp.files);
memset(&exp, 0, sizeof(exp));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
- cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, &exp));
+ cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, NULL, &exp));
cl_assert_equal_i(0, exp.files);
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(diff_so_far);
+ 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);
+}