diff options
author | Russell Belfer <rb@github.com> | 2012-09-25 10:48:50 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-09-25 16:35:05 -0700 |
commit | 642863086575a61b3ed0bbbe909f4f07d87ff9db (patch) | |
tree | 22cb6c0d2355e4a15edd645104b39fe2c33c97ac /tests-clar/diff/diff_helpers.c | |
parent | 5f69a31f7d706aa5788ad9937391577a66e3c77d (diff) | |
download | libgit2-642863086575a61b3ed0bbbe909f4f07d87ff9db.tar.gz |
Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code. The only
really interesting one is that when we merge two diffs, we now
have to actually exclude diff delta records that are not supposed
to be tracked, as opposed to before where they could be included
because they would be skipped silently by `git_diff_foreach()`.
Other than that, there are just minor errors.
Diffstat (limited to 'tests-clar/diff/diff_helpers.c')
-rw-r--r-- | tests-clar/diff/diff_helpers.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c index 1c0435975..0c4721897 100644 --- a/tests-clar/diff/diff_helpers.c +++ b/tests-clar/diff/diff_helpers.c @@ -120,7 +120,7 @@ int diff_foreach_via_iterator( size_t h, num_h; cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d)); - cl_assert(delta && patch); + cl_assert(delta); /* call file_cb for this file */ if (file_cb != NULL && file_cb(data, delta, (float)d / num_d) != 0) { @@ -128,6 +128,12 @@ int diff_foreach_via_iterator( goto abort; } + /* if there are no changes, then the patch will be NULL */ + if (!patch) { + cl_assert(delta->status == GIT_DELTA_UNMODIFIED || delta->binary == 1); + continue; + } + if (!hunk_cb && !line_cb) { git_diff_patch_free(patch); continue; |