diff options
author | Vicent Martà <vicent@github.com> | 2012-10-09 11:45:50 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2012-10-09 11:45:50 -0700 |
commit | 21e0d297af95e49b933c2a8d09994a32011354b1 (patch) | |
tree | 1e248d6899feac797f0c1307ad7cf52cead42389 /tests-clar/diff/diff_helpers.c | |
parent | aa4437f637371c531355029686cb5780fd99c988 (diff) | |
parent | 5d1308f25ff36d03f0a22451642cc0f2a931daae (diff) | |
download | libgit2-21e0d297af95e49b933c2a8d09994a32011354b1.tar.gz |
Merge pull request #967 from arrbee/diff-submodule-tests-and-fixes
Diff submodule tests and fixes
Diffstat (limited to 'tests-clar/diff/diff_helpers.c')
-rw-r--r-- | tests-clar/diff/diff_helpers.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c index b4c68769e..de0e7e074 100644 --- a/tests-clar/diff/diff_helpers.c +++ b/tests-clar/diff/diff_helpers.c @@ -30,10 +30,13 @@ int diff_file_fn( GIT_UNUSED(progress); - if (delta->binary) + e->files++; + + if (delta->binary) { e->at_least_one_of_them_is_binary = true; + e->files_binary++; + } - e->files++; switch (delta->status) { case GIT_DELTA_ADDED: e->file_adds++; break; case GIT_DELTA_DELETED: e->file_dels++; break; @@ -180,3 +183,25 @@ abort: giterr_clear(); return GIT_EUSER; } + +static int diff_print_cb( + void *cb_data, + const git_diff_delta *delta, + const git_diff_range *range, + char line_origin, /**< GIT_DIFF_LINE_... value from above */ + const char *content, + size_t content_len) +{ + GIT_UNUSED(cb_data); + GIT_UNUSED(delta); + GIT_UNUSED(range); + GIT_UNUSED(line_origin); + GIT_UNUSED(content_len); + fputs(content, (FILE *)cb_data); + return 0; +} + +void diff_print(FILE *fp, git_diff_list *diff) +{ + cl_git_pass(git_diff_print_patch(diff, fp ? fp : stderr, diff_print_cb)); +} |