diff options
author | Vicent Marti <vicent@github.com> | 2014-04-18 12:33:19 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-04-18 12:33:19 +0200 |
commit | 28fd7206b1359b6564bad3c66382b47a8f2e3eb1 (patch) | |
tree | e0d9204bdfea2a948d94b2b14d382a697b00b6db /tests/diff/diff_helpers.c | |
parent | 2bed3553f4595a42d9a6884edc66b991e21f881e (diff) | |
parent | 8303827226db114a1157e6173e731f316c217851 (diff) | |
download | libgit2-28fd7206b1359b6564bad3c66382b47a8f2e3eb1.tar.gz |
Merge pull request #2108 from libgit2/rb/threadsafe-index-iterator
Make index iterator thread safe
Diffstat (limited to 'tests/diff/diff_helpers.c')
-rw-r--r-- | tests/diff/diff_helpers.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/tests/diff/diff_helpers.c b/tests/diff/diff_helpers.c index 33bb561f6..279cb20c5 100644 --- a/tests/diff/diff_helpers.c +++ b/tests/diff/diff_helpers.c @@ -1,5 +1,6 @@ #include "clar_libgit2.h" #include "diff_helpers.h" +#include "git2/sys/diff.h" git_tree *resolve_commit_oid_to_tree( git_repository *repo, @@ -215,32 +216,16 @@ abort: return GIT_EUSER; } -static int diff_print_cb( - const git_diff_delta *delta, - const git_diff_hunk *hunk, - const git_diff_line *line, - void *payload) -{ - FILE *fp = payload; - - GIT_UNUSED(delta); GIT_UNUSED(hunk); - - if (line->origin == GIT_DIFF_LINE_CONTEXT || - line->origin == GIT_DIFF_LINE_ADDITION || - line->origin == GIT_DIFF_LINE_DELETION) - fputc(line->origin, fp); - fwrite(line->content, 1, line->content_len, fp); - return 0; -} - void diff_print(FILE *fp, git_diff *diff) { - cl_git_pass(git_diff_print( - diff, GIT_DIFF_FORMAT_PATCH, diff_print_cb, fp ? fp : stderr)); + cl_git_pass( + git_diff_print(diff, GIT_DIFF_FORMAT_PATCH, + git_diff_print_callback__to_file_handle, fp ? fp : stderr)); } void diff_print_raw(FILE *fp, git_diff *diff) { - cl_git_pass(git_diff_print( - diff, GIT_DIFF_FORMAT_RAW, diff_print_cb, fp ? fp : stderr)); + cl_git_pass( + git_diff_print(diff, GIT_DIFF_FORMAT_RAW, + git_diff_print_callback__to_file_handle, fp ? fp : stderr)); } |