summaryrefslogtreecommitdiff
path: root/tests-clar/diff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-10-11 14:51:54 -0700
committerRussell Belfer <rb@github.com>2013-10-11 14:51:54 -0700
commit3ff1d123736e5686fb9ec16e65828d5b8ffa2b30 (patch)
tree05c6baebe50c590008f91cf7d56732f52ca8ef66 /tests-clar/diff
parent743531372a00e41246026910e2361684e2aad59f (diff)
downloadlibgit2-3ff1d123736e5686fb9ec16e65828d5b8ffa2b30.tar.gz
Rename diff objects and split patch.h
This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
Diffstat (limited to 'tests-clar/diff')
-rw-r--r--tests-clar/diff/blob.c222
-rw-r--r--tests-clar/diff/diff_helpers.c36
-rw-r--r--tests-clar/diff/diff_helpers.h12
-rw-r--r--tests-clar/diff/diffiter.c110
-rw-r--r--tests-clar/diff/drivers.c58
-rw-r--r--tests-clar/diff/index.c12
-rw-r--r--tests-clar/diff/notify.c16
-rw-r--r--tests-clar/diff/patch.c146
-rw-r--r--tests-clar/diff/pathspec.c8
-rw-r--r--tests-clar/diff/rename.c108
-rw-r--r--tests-clar/diff/submodules.c84
-rw-r--r--tests-clar/diff/tree.c38
-rw-r--r--tests-clar/diff/workdir.c150
13 files changed, 500 insertions, 500 deletions
diff --git a/tests-clar/diff/blob.c b/tests-clar/diff/blob.c
index 42b9fcd5f..bed0da0bf 100644
--- a/tests-clar/diff/blob.c
+++ b/tests-clar/diff/blob.c
@@ -142,7 +142,7 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
{
git_blob *a, *b, *c;
git_oid a_oid, b_oid, c_oid;
- git_diff_patch *p;
+ git_patch *p;
const git_diff_delta *delta;
size_t tc, ta, td;
@@ -161,11 +161,11 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
/* Doing the equivalent of a `git diff -U1` on these files */
/* diff on tests/resources/attr/root_test1 */
- cl_git_pass(git_diff_patch_from_blobs(&p, a, NULL, b, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, a, NULL, b, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
@@ -173,22 +173,22 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
cl_assert(git_oid_equal(git_blob_id(b), &delta->new_file.oid));
cl_assert_equal_sz(git_blob_rawsize(b), delta->new_file.size);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(6, git_diff_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(6, git_patch_num_lines_in_hunk(p, 0));
- cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+ cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
cl_assert_equal_i(1, (int)tc);
cl_assert_equal_i(5, (int)ta);
cl_assert_equal_i(0, (int)td);
- git_diff_patch_free(p);
+ git_patch_free(p);
/* diff on tests/resources/attr/root_test2 */
- cl_git_pass(git_diff_patch_from_blobs(&p, b, NULL, c, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, b, NULL, c, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
cl_assert(git_oid_equal(git_blob_id(b), &delta->old_file.oid));
@@ -196,22 +196,22 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(15, git_diff_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(15, git_patch_num_lines_in_hunk(p, 0));
- cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+ cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
cl_assert_equal_i(3, (int)tc);
cl_assert_equal_i(9, (int)ta);
cl_assert_equal_i(3, (int)td);
- git_diff_patch_free(p);
+ git_patch_free(p);
/* diff on tests/resources/attr/root_test3 */
- cl_git_pass(git_diff_patch_from_blobs(&p, a, NULL, c, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, a, NULL, c, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
cl_assert(git_oid_equal(git_blob_id(a), &delta->old_file.oid));
@@ -219,19 +219,19 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
cl_assert(git_oid_equal(git_blob_id(c), &delta->new_file.oid));
cl_assert_equal_sz(git_blob_rawsize(c), delta->new_file.size);
- cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+ cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
cl_assert_equal_i(0, (int)tc);
cl_assert_equal_i(12, (int)ta);
cl_assert_equal_i(1, (int)td);
- git_diff_patch_free(p);
+ git_patch_free(p);
/* one more */
- cl_git_pass(git_diff_patch_from_blobs(&p, c, NULL, d, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, c, NULL, d, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_MODIFIED, delta->status);
cl_assert(git_oid_equal(git_blob_id(c), &delta->old_file.oid));
@@ -239,16 +239,16 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
- cl_assert_equal_i(2, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(5, git_diff_patch_num_lines_in_hunk(p, 0));
- cl_assert_equal_i(9, git_diff_patch_num_lines_in_hunk(p, 1));
+ cl_assert_equal_i(2, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(5, git_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(9, git_patch_num_lines_in_hunk(p, 1));
- cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+ cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
cl_assert_equal_i(4, (int)tc);
cl_assert_equal_i(6, (int)ta);
cl_assert_equal_i(4, (int)td);
- git_diff_patch_free(p);
+ git_patch_free(p);
git_blob_free(a);
git_blob_free(b);
@@ -317,16 +317,16 @@ void test_diff_blob__can_compare_against_null_blobs(void)
void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
{
git_blob *e = NULL;
- git_diff_patch *p;
+ git_patch *p;
const git_diff_delta *delta;
int line;
char origin;
- cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.oid));
@@ -334,24 +334,24 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
cl_assert(git_oid_iszero(&delta->new_file.oid));
cl_assert_equal_sz(0, delta->new_file.size);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(14, git_diff_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(14, git_patch_num_lines_in_hunk(p, 0));
- for (line = 0; line < git_diff_patch_num_lines_in_hunk(p, 0); ++line) {
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ for (line = 0; line < git_patch_num_lines_in_hunk(p, 0); ++line) {
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, NULL, NULL, NULL, NULL, p, 0, line));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
}
- git_diff_patch_free(p);
+ git_patch_free(p);
opts.flags |= GIT_DIFF_REVERSE;
- cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, d, NULL, e, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
cl_assert(git_oid_iszero(&delta->old_file.oid));
@@ -359,44 +359,44 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(14, git_diff_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(14, git_patch_num_lines_in_hunk(p, 0));
- for (line = 0; line < git_diff_patch_num_lines_in_hunk(p, 0); ++line) {
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ for (line = 0; line < git_patch_num_lines_in_hunk(p, 0); ++line) {
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, NULL, NULL, NULL, NULL, p, 0, line));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
}
- git_diff_patch_free(p);
+ git_patch_free(p);
opts.flags ^= GIT_DIFF_REVERSE;
- cl_git_pass(git_diff_patch_from_blobs(&p, alien, NULL, NULL, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, alien, NULL, NULL, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_DELETED, delta->status);
cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blobs(&p, NULL, NULL, alien, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, NULL, NULL, alien, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
- git_diff_patch_free(p);
+ git_patch_free(p);
}
static void assert_identical_blobs_comparison(diff_expects *expected)
@@ -437,13 +437,13 @@ void test_diff_blob__can_compare_identical_blobs(void)
void test_diff_blob__can_compare_identical_blobs_with_patch(void)
{
- git_diff_patch *p;
+ git_patch *p;
const git_diff_delta *delta;
- cl_git_pass(git_diff_patch_from_blobs(&p, d, NULL, d, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, d, NULL, d, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
cl_assert_equal_sz(delta->old_file.size, git_blob_rawsize(d));
@@ -451,13 +451,13 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert_equal_sz(delta->new_file.size, git_blob_rawsize(d));
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.oid));
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
- git_diff_patch_free(p);
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blobs(&p, NULL, NULL, NULL, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, NULL, NULL, NULL, NULL, &opts));
cl_assert(p != NULL);
- delta = git_diff_patch_delta(p);
+ delta = git_patch_delta(p);
cl_assert(delta != NULL);
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, delta->status);
cl_assert_equal_sz(0, delta->old_file.size);
@@ -465,14 +465,14 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert_equal_sz(0, delta->new_file.size);
cl_assert(git_oid_iszero(&delta->new_file.oid));
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
- git_diff_patch_free(p);
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blobs(&p, alien, NULL, alien, NULL, &opts));
+ cl_git_pass(git_patch_from_blobs(&p, alien, NULL, alien, NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
- git_diff_patch_free(p);
+ cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_patch_delta(p)->status);
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+ git_patch_free(p);
}
static void assert_binary_blobs_comparison(diff_expects *expected)
@@ -693,7 +693,7 @@ void test_diff_blob__can_compare_blob_to_buffer(void)
void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
{
- git_diff_patch *p;
+ git_patch *p;
git_blob *a;
git_oid a_oid;
const char *a_content = "Hello from the root\n";
@@ -705,58 +705,58 @@ void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
/* diff from blob a to content of b */
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, a, NULL, b_content, strlen(b_content), NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_MODIFIED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(6, git_diff_patch_num_lines_in_hunk(p, 0));
+ cl_assert_equal_i(GIT_DELTA_MODIFIED, git_patch_delta(p)->status);
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(6, git_patch_num_lines_in_hunk(p, 0));
- cl_git_pass(git_diff_patch_line_stats(&tc, &ta, &td, p));
+ cl_git_pass(git_patch_line_stats(&tc, &ta, &td, p));
cl_assert_equal_i(1, (int)tc);
cl_assert_equal_i(5, (int)ta);
cl_assert_equal_i(0, (int)td);
- git_diff_patch_free(p);
+ git_patch_free(p);
/* diff from blob a to content of a */
opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, a, NULL, a_content, strlen(a_content), NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(0, (int)git_diff_patch_num_hunks(p));
- git_diff_patch_free(p);
+ cl_assert_equal_i(GIT_DELTA_UNMODIFIED, git_patch_delta(p)->status);
+ cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
+ git_patch_free(p);
/* diff from NULL blob to content of a */
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, NULL, NULL, a_content, strlen(a_content), NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_ADDED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
- git_diff_patch_free(p);
+ cl_assert_equal_i(GIT_DELTA_ADDED, git_patch_delta(p)->status);
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+ git_patch_free(p);
/* diff from blob a to NULL buffer */
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, a, NULL, NULL, 0, NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_DELETED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
- git_diff_patch_free(p);
+ cl_assert_equal_i(GIT_DELTA_DELETED, git_patch_delta(p)->status);
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+ git_patch_free(p);
/* diff with reverse */
opts.flags ^= GIT_DIFF_REVERSE;
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, a, NULL, NULL, 0, NULL, &opts));
cl_assert(p != NULL);
- cl_assert_equal_i(GIT_DELTA_ADDED, git_diff_patch_delta(p)->status);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(p));
- cl_assert_equal_i(1, git_diff_patch_num_lines_in_hunk(p, 0));
- git_diff_patch_free(p);
+ cl_assert_equal_i(GIT_DELTA_ADDED, git_patch_delta(p)->status);
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
+ cl_assert_equal_i(1, git_patch_num_lines_in_hunk(p, 0));
+ git_patch_free(p);
git_blob_free(a);
}
@@ -853,7 +853,7 @@ void test_diff_blob__using_path_and_attributes(void)
"0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\n0123456789\n";
size_t bin_len = 33;
const char *changed;
- git_diff_patch *p;
+ git_patch *p;
char *pout;
/* set up custom diff drivers and 'diff' attribute mappings for them */
@@ -950,9 +950,9 @@ void test_diff_blob__using_path_and_attributes(void)
cl_assert_equal_i(3, expected.line_adds);
cl_assert_equal_i(0, expected.line_dels);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, nonbin, "zzz.normal", changed, strlen(changed), NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.normal b/zzz.normal\n"
"index 45141a7..75b0dbb 100644\n"
@@ -963,21 +963,21 @@ void test_diff_blob__using_path_and_attributes(void)
"+And more\n"
"+Go here\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, nonbin, "zzz.binary", changed, strlen(changed), NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.binary b/zzz.binary\n"
"index 45141a7..75b0dbb 100644\n"
"Binary files a/zzz.binary and b/zzz.binary differ\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, nonbin, "zzz.alphary", changed, strlen(changed), NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.alphary b/zzz.alphary\n"
"index 45141a7..75b0dbb 100644\n"
@@ -988,11 +988,11 @@ void test_diff_blob__using_path_and_attributes(void)
"+And more\n"
"+Go here\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, nonbin, "zzz.numary", changed, strlen(changed), NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.numary b/zzz.numary\n"
"index 45141a7..75b0dbb 100644\n"
@@ -1003,7 +1003,7 @@ void test_diff_blob__using_path_and_attributes(void)
"+And more\n"
"+Go here\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
/* "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\n0123456789\n"
* 33 bytes
@@ -1011,19 +1011,19 @@ void test_diff_blob__using_path_and_attributes(void)
changed = "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\x00\nreplace a line\n";
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, bin, "zzz.normal", changed, 37, NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.normal b/zzz.normal\n"
"index b435cd5..1604519 100644\n"
"Binary files a/zzz.normal and b/zzz.normal differ\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, bin, "zzz.textary", changed, 37, NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.textary b/zzz.textary\n"
"index b435cd5..1604519 100644\n"
@@ -1033,11 +1033,11 @@ void test_diff_blob__using_path_and_attributes(void)
"-0123456789\n"
"+replace a line\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, bin, "zzz.textalphary", changed, 37, NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.textalphary b/zzz.textalphary\n"
"index b435cd5..1604519 100644\n"
@@ -1047,11 +1047,11 @@ void test_diff_blob__using_path_and_attributes(void)
"-0123456789\n"
"+replace a line\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
- cl_git_pass(git_diff_patch_from_blob_and_buffer(
+ cl_git_pass(git_patch_from_blob_and_buffer(
&p, bin, "zzz.textnumary", changed, 37, NULL, &opts));
- cl_git_pass(git_diff_patch_to_str(&pout, p));
+ cl_git_pass(git_patch_to_str(&pout, p));
cl_assert_equal_s(
"diff --git a/zzz.textnumary b/zzz.textnumary\n"
"index b435cd5..1604519 100644\n"
@@ -1061,7 +1061,7 @@ void test_diff_blob__using_path_and_attributes(void)
"-0123456789\n"
"+replace a line\n", pout);
git__free(pout);
- git_diff_patch_free(p);
+ git_patch_free(p);
git_blob_free(nonbin);
git_blob_free(bin);
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c
index 3452f231d..34ef1df5a 100644
--- a/tests-clar/diff/diff_helpers.c
+++ b/tests-clar/diff/diff_helpers.c
@@ -95,7 +95,7 @@ int diff_print_file_cb(
int diff_hunk_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
const char *header,
size_t header_len,
void *payload)
@@ -115,7 +115,7 @@ int diff_hunk_cb(
int diff_line_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
char line_origin,
const char *content,
size_t content_len,
@@ -149,25 +149,25 @@ int diff_line_cb(
}
int diff_foreach_via_iterator(
- git_diff_list *diff,
+ git_diff *diff,
git_diff_file_cb file_cb,
git_diff_hunk_cb hunk_cb,
- git_diff_data_cb line_cb,
+ git_diff_line_cb line_cb,
void *data)
{
size_t d, num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
size_t h, num_h;
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
cl_assert(delta);
/* call file_cb for this file */
if (file_cb != NULL && file_cb(delta, (float)d / num_d, data) != 0) {
- git_diff_patch_free(patch);
+ git_patch_free(patch);
goto abort;
}
@@ -179,22 +179,22 @@ int diff_foreach_via_iterator(
}
if (!hunk_cb && !line_cb) {
- git_diff_patch_free(patch);
+ git_patch_free(patch);
continue;
}
- num_h = git_diff_patch_num_hunks(patch);
+ num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
- const git_diff_range *range;
+ const git_diff_hunk *range;
const char *hdr;
size_t hdr_len, l, num_l;
- cl_git_pass(git_diff_patch_get_hunk(
+ cl_git_pass(git_patch_get_hunk(
&range, &hdr, &hdr_len, &num_l, patch, h));
if (hunk_cb && hunk_cb(delta, range, hdr, hdr_len, data) != 0) {
- git_diff_patch_free(patch);
+ git_patch_free(patch);
goto abort;
}
@@ -204,19 +204,19 @@ int diff_foreach_via_iterator(
size_t line_len;
int old_lineno, new_lineno;
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &line, &line_len, &old_lineno, &new_lineno,
patch, h, l));
if (line_cb &&
line_cb(delta, range, origin, line, line_len, data) != 0) {
- git_diff_patch_free(patch);
+ git_patch_free(patch);
goto abort;
}
}
}
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
return 0;
@@ -228,7 +228,7 @@ abort:
static int diff_print_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
char line_origin, /**< GIT_DIFF_LINE_... value from above */
const char *content,
size_t content_len,
@@ -243,12 +243,12 @@ static int diff_print_cb(
return 0;
}
-void diff_print(FILE *fp, git_diff_list *diff)
+void diff_print(FILE *fp, git_diff *diff)
{
cl_git_pass(git_diff_print_patch(diff, diff_print_cb, fp ? fp : stderr));
}
-void diff_print_raw(FILE *fp, git_diff_list *diff)
+void diff_print_raw(FILE *fp, git_diff *diff)
{
cl_git_pass(git_diff_print_raw(diff, diff_print_cb, fp ? fp : stderr));
}
diff --git a/tests-clar/diff/diff_helpers.h b/tests-clar/diff/diff_helpers.h
index bb76d0076..e3ad61f29 100644
--- a/tests-clar/diff/diff_helpers.h
+++ b/tests-clar/diff/diff_helpers.h
@@ -44,25 +44,25 @@ extern int diff_print_file_cb(
extern int diff_hunk_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
const char *header,
size_t header_len,
void *cb_data);
extern int diff_line_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
char line_origin,
const char *content,
size_t content_len,
void *cb_data);
extern int diff_foreach_via_iterator(
- git_diff_list *diff,
+ git_diff *diff,
git_diff_file_cb file_cb,
git_diff_hunk_cb hunk_cb,
- git_diff_data_cb line_cb,
+ git_diff_line_cb line_cb,
void *data);
-extern void diff_print(FILE *fp, git_diff_list *diff);
-extern void diff_print_raw(FILE *fp, git_diff_list *diff);
+extern void diff_print(FILE *fp, git_diff *diff);
+extern void diff_print_raw(FILE *fp, git_diff *diff);
diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c
index ea5908475..48b56e20e 100644
--- a/tests-clar/diff/diffiter.c
+++ b/tests-clar/diff/diffiter.c
@@ -13,7 +13,7 @@ void test_diff_diffiter__cleanup(void)
void test_diff_diffiter__create(void)
{
git_repository *repo = cl_git_sandbox_init("attr");
- git_diff_list *diff;
+ git_diff *diff;
size_t d, num_d;
cl_git_pass(git_diff_index_to_workdir(&diff, repo, NULL, NULL));
@@ -21,16 +21,16 @@ void test_diff_diffiter__create(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
const git_diff_delta *delta;
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_diffiter__iterate_files_1(void)
{
git_repository *repo = cl_git_sandbox_init("attr");
- git_diff_list *diff;
+ git_diff *diff;
size_t d, num_d;
diff_expects exp = { 0 };
@@ -40,20 +40,20 @@ void test_diff_diffiter__iterate_files_1(void)
for (d = 0; d < num_d; ++d) {
const git_diff_delta *delta;
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
cl_assert(delta != NULL);
diff_file_cb(delta, (float)d / (float)num_d, &exp);
}
cl_assert_equal_sz(6, exp.files);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_diffiter__iterate_files_2(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_list *diff;
+ git_diff *diff;
size_t d, num_d;
int count = 0;
@@ -64,20 +64,20 @@ void test_diff_diffiter__iterate_files_2(void)
for (d = 0; d < num_d; ++d) {
const git_diff_delta *delta;
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, d));
cl_assert(delta != NULL);
count++;
}
cl_assert_equal_i(8, count);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_diffiter__iterate_files_and_hunks(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
size_t d, num_d;
int file_count = 0, hunk_count = 0;
@@ -90,25 +90,25 @@ void test_diff_diffiter__iterate_files_and_hunks(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
size_t h, num_h;
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
cl_assert(delta);
cl_assert(patch);
file_count++;
- num_h = git_diff_patch_num_hunks(patch);
+ num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
- const git_diff_range *range;
+ const git_diff_hunk *range;
const char *header;
size_t header_len, num_l;
- cl_git_pass(git_diff_patch_get_hunk(
+ cl_git_pass(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, h));
cl_assert(range);
@@ -117,20 +117,20 @@ void test_diff_diffiter__iterate_files_and_hunks(void)
hunk_count++;
}
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
cl_assert_equal_i(13, file_count);
cl_assert_equal_i(8, hunk_count);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_diffiter__max_size_threshold(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
int file_count = 0, binary_count = 0, hunk_count = 0;
size_t d, num_d;
@@ -142,27 +142,27 @@ void test_diff_diffiter__max_size_threshold(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
cl_assert(delta);
cl_assert(patch);
file_count++;
- hunk_count += (int)git_diff_patch_num_hunks(patch);
+ hunk_count += (int)git_patch_num_hunks(patch);
assert((delta->flags & (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)) != 0);
binary_count += ((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
cl_assert_equal_i(13, file_count);
cl_assert_equal_i(0, binary_count);
cl_assert_equal_i(8, hunk_count);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* try again with low file size threshold */
@@ -177,18 +177,18 @@ void test_diff_diffiter__max_size_threshold(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
file_count++;
- hunk_count += (int)git_diff_patch_num_hunks(patch);
+ hunk_count += (int)git_patch_num_hunks(patch);
assert((delta->flags & (GIT_DIFF_FLAG_BINARY|GIT_DIFF_FLAG_NOT_BINARY)) != 0);
binary_count += ((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
cl_assert_equal_i(13, file_count);
@@ -200,7 +200,7 @@ void test_diff_diffiter__max_size_threshold(void)
cl_assert_equal_i(3, binary_count);
cl_assert_equal_i(5, hunk_count);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
@@ -208,7 +208,7 @@ void test_diff_diffiter__iterate_all(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp = {0};
size_t d, num_d;
@@ -220,21 +220,21 @@ void test_diff_diffiter__iterate_all(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
size_t h, num_h;
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
cl_assert(patch && delta);
exp.files++;
- num_h = git_diff_patch_num_hunks(patch);
+ num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
- const git_diff_range *range;
+ const git_diff_hunk *range;
const char *header;
size_t header_len, l, num_l;
- cl_git_pass(git_diff_patch_get_hunk(
+ cl_git_pass(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, h));
cl_assert(range && header);
exp.hunks++;
@@ -244,33 +244,33 @@ void test_diff_diffiter__iterate_all(void)
const char *content;
size_t content_len;
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &content, &content_len, NULL, NULL, patch, h, l));
cl_assert(content);
exp.lines++;
}
}
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
cl_assert_equal_i(13, exp.files);
cl_assert_equal_i(8, exp.hunks);
cl_assert_equal_i(14, exp.lines);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
-static void iterate_over_patch(git_diff_patch *patch, diff_expects *exp)
+static void iterate_over_patch(git_patch *patch, diff_expects *exp)
{
- size_t h, num_h = git_diff_patch_num_hunks(patch), num_l;
+ size_t h, num_h = git_patch_num_hunks(patch), num_l;
exp->files++;
exp->hunks += (int)num_h;
/* let's iterate in reverse, just because we can! */
for (h = 1, num_l = 0; h <= num_h; ++h)
- num_l += git_diff_patch_num_lines_in_hunk(patch, num_h - h);
+ num_l += git_patch_num_lines_in_hunk(patch, num_h - h);
exp->lines += (int)num_l;
}
@@ -281,9 +281,9 @@ void test_diff_diffiter__iterate_randomly_while_saving_state(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp = {0};
- git_diff_patch *patches[PATCH_CACHE];
+ git_patch *patches[PATCH_CACHE];
size_t p, d, num_d;
memset(patches, 0, sizeof(patches));
@@ -308,32 +308,32 @@ void test_diff_diffiter__iterate_randomly_while_saving_state(void)
for (d = 0; d < num_d; ++d) {
/* take old patch */
- git_diff_patch *patch = patches[p];
+ git_patch *patch = patches[p];
patches[p] = NULL;
/* cache new patch */
- cl_git_pass(git_diff_get_patch(&patches[p], NULL, diff, d));
+ cl_git_pass(git_patch_from_diff(&patches[p], NULL, diff, d));
cl_assert(patches[p] != NULL);
/* process old patch if non-NULL */
if (patch != NULL) {
iterate_over_patch(patch, &exp);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
p = rand() % PATCH_CACHE;
}
/* free diff list now - refcounts should keep things safe */
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* process remaining unprocessed patches */
for (p = 0; p < PATCH_CACHE; p++) {
- git_diff_patch *patch = patches[p];
+ git_patch *patch = patches[p];
if (patch != NULL) {
iterate_over_patch(patch, &exp);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
}
@@ -416,7 +416,7 @@ static const char *expected_patch_text[8] = {
void test_diff_diffiter__iterate_and_generate_patch_text(void)
{
git_repository *repo = cl_git_sandbox_init("status");
- git_diff_list *diff;
+ git_diff *diff;
size_t d, num_d;
cl_git_pass(git_diff_index_to_workdir(&diff, repo, NULL, NULL));
@@ -425,28 +425,28 @@ void test_diff_diffiter__iterate_and_generate_patch_text(void)
cl_assert_equal_i(8, (int)num_d);
for (d = 0; d < num_d; ++d) {
- git_diff_patch *patch;
+ git_patch *patch;
char *text;
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, d));
cl_assert(patch != NULL);
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected_patch_text[d], text);
git__free(text);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_diffiter__checks_options_version(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
const git_error *err;
opts.version = 0;
diff --git a/tests-clar/diff/drivers.c b/tests-clar/diff/drivers.c
index 719d229fc..518f24e7b 100644
--- a/tests-clar/diff/drivers.c
+++ b/tests-clar/diff/drivers.c
@@ -20,8 +20,8 @@ void test_diff_drivers__patterns(void)
git_config *cfg;
const char *one_sha = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
git_tree *one;
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
char *text;
const char *expected0 = "diff --git a/untimely.txt b/untimely.txt\nindex 9a69d96..57fd0cf 100644\n--- a/untimely.txt\n+++ b/untimely.txt\n@@ -22,3 +22,5 @@ Comes through the blood of the vanguards who\n dreamed--too soon--it had sounded.\r\n \r\n -- Rudyard Kipling\r\n+\r\n+Some new stuff\r\n";
const char *expected1 = "diff --git a/untimely.txt b/untimely.txt\nindex 9a69d96..57fd0cf 100644\nBinary files a/untimely.txt and b/untimely.txt differ\n";
@@ -35,7 +35,7 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(0, (int)git_diff_num_deltas(diff));
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* default diff */
@@ -44,13 +44,13 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected0, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
/* attribute diff set to false */
@@ -59,13 +59,13 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected1, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
/* attribute diff set to unconfigured value (should use default) */
@@ -74,13 +74,13 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected0, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
/* let's define that driver */
@@ -91,13 +91,13 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected1, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
/* let's use a real driver with some regular expressions */
@@ -112,13 +112,13 @@ void test_diff_drivers__patterns(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, one, NULL));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected2, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
git_tree_free(one);
}
@@ -127,8 +127,8 @@ void test_diff_drivers__long_lines(void)
{
const char *base = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non nisi ligula. Ut viverra enim sed lobortis suscipit.\nPhasellus eget erat odio. Praesent at est iaculis, ultricies augue vel, dignissim risus. Suspendisse at nisi quis turpis fringilla rutrum id sit amet nulla.\nNam eget dolor fermentum, aliquet nisl at, convallis tellus. Pellentesque rhoncus erat enim, id porttitor elit euismod quis.\nMauris sollicitudin magna odio, non egestas libero vehicula ut. Etiam et quam velit. Fusce eget libero rhoncus, ultricies felis sit amet, egestas purus.\nAliquam in semper tellus. Pellentesque adipiscing rutrum velit, quis malesuada lacus consequat eget.\n";
git_index *idx;
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
char *actual;
const char *expected = "diff --git a/longlines.txt b/longlines.txt\nindex c1ce6ef..0134431 100644\n--- a/longlines.txt\n+++ b/longlines.txt\n@@ -3,3 +3,5 @@ Phasellus eget erat odio. Praesent at est iaculis, ultricies augue vel, dignissi\n Nam eget dolor fermentum, aliquet nisl at, convallis tellus. Pellentesque rhoncus erat enim, id porttitor elit euismod quis.\n Mauris sollicitudin magna odio, non egestas libero vehicula ut. Etiam et quam velit. Fusce eget libero rhoncus, ultricies felis sit amet, egestas purus.\n Aliquam in semper tellus. Pellentesque adipiscing rutrum velit, quis malesuada lacus consequat eget.\n+newline\n+newline\n";
@@ -144,8 +144,8 @@ void test_diff_drivers__long_lines(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
cl_assert_equal_sz(1, git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&actual, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&actual, patch));
/* if chmod not supported, overwrite mode bits since anything is possible */
if (!cl_is_chmod_supported()) {
@@ -157,7 +157,7 @@ void test_diff_drivers__long_lines(void)
cl_assert_equal_s(expected, actual);
free(actual);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
}
diff --git a/tests-clar/diff/index.c b/tests-clar/diff/index.c
index e1c617dae..8f4567137 100644
--- a/tests-clar/diff/index.c
+++ b/tests-clar/diff/index.c
@@ -21,7 +21,7 @@ void test_diff_index__0(void)
git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
cl_assert(a);
@@ -56,7 +56,7 @@ void test_diff_index__0(void)
cl_assert_equal_i(6, exp.line_adds);
cl_assert_equal_i(2, exp.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
memset(&exp, 0, sizeof(exp));
@@ -84,7 +84,7 @@ void test_diff_index__0(void)
cl_assert_equal_i(11, exp.line_adds);
cl_assert_equal_i(2, exp.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
git_tree_free(a);
@@ -114,7 +114,7 @@ void test_diff_index__1(void)
git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
cl_assert(a);
@@ -134,7 +134,7 @@ void test_diff_index__1(void)
cl_assert_equal_i(2, exp.files);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
git_tree_free(a);
@@ -146,7 +146,7 @@ void test_diff_index__checks_options_version(void)
const char *a_commit = "26a125ee1bf";
git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
const git_error *err;
opts.version = 0;
diff --git a/tests-clar/diff/notify.c b/tests-clar/diff/notify.c
index 433b4a9c1..cc33cb71c 100644
--- a/tests-clar/diff/notify.c
+++ b/tests-clar/diff/notify.c
@@ -13,7 +13,7 @@ void test_diff_notify__cleanup(void)
}
static int assert_called_notifications(
- const git_diff_list *diff_so_far,
+ const git_diff *diff_so_far,
const git_diff_delta *delta_to_add,
const char *matched_pathspec,
void *payload)
@@ -45,7 +45,7 @@ static void test_notify(
int expected_diffed_files_count)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
g_repo = cl_git_sandbox_init("status");
@@ -63,7 +63,7 @@ static void test_notify(
cl_assert_equal_i(expected_diffed_files_count, exp.files);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_notify__notify_single_pathspec(void)
@@ -155,7 +155,7 @@ void test_diff_notify__notify_catchall(void)
}
static int abort_diff(
- const git_diff_list *diff_so_far,
+ const git_diff *diff_so_far,
const git_diff_delta *delta_to_add,
const char *matched_pathspec,
void *payload)
@@ -171,7 +171,7 @@ static int abort_diff(
void test_diff_notify__notify_cb_can_abort_diff(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
char *pathspec = NULL;
g_repo = cl_git_sandbox_init("status");
@@ -189,7 +189,7 @@ void test_diff_notify__notify_cb_can_abort_diff(void)
}
static int filter_all(
- const git_diff_list *diff_so_far,
+ const git_diff *diff_so_far,
const git_diff_delta *delta_to_add,
const char *matched_pathspec,
void *payload)
@@ -205,7 +205,7 @@ static int filter_all(
void test_diff_notify__notify_cb_can_be_used_as_filtering_function(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
char *pathspec = NULL;
diff_expects exp;
@@ -224,5 +224,5 @@ void test_diff_notify__notify_cb_can_be_used_as_filtering_function(void)
cl_assert_equal_i(0, exp.files);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
diff --git a/tests-clar/diff/patch.c b/tests-clar/diff/patch.c
index 171abc819..e5d8fca9a 100644
--- a/tests-clar/diff/patch.c
+++ b/tests-clar/diff/patch.c
@@ -26,7 +26,7 @@ void test_diff_patch__cleanup(void)
static int check_removal_cb(
const git_diff_delta *delta,
- const git_diff_range *range,
+ const git_diff_hunk *range,
char line_origin,
const char *formatted_output,
size_t output_len,
@@ -86,7 +86,7 @@ void test_diff_patch__can_properly_display_the_removal_of_a_file(void)
const char *one_sha = "26a125e";
const char *another_sha = "735b6a2";
git_tree *one, *another;
- git_diff_list *diff;
+ git_diff *diff;
g_repo = cl_git_sandbox_init("status");
@@ -97,7 +97,7 @@ void test_diff_patch__can_properly_display_the_removal_of_a_file(void)
cl_git_pass(git_diff_print_patch(diff, check_removal_cb, NULL));
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(another);
git_tree_free(one);
@@ -108,8 +108,8 @@ void test_diff_patch__to_string(void)
const char *one_sha = "26a125e";
const char *another_sha = "735b6a2";
git_tree *one, *another;
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
char *text;
const char *expected = "diff --git a/subdir.txt b/subdir.txt\ndeleted file mode 100644\nindex e8ee89e..0000000\n--- a/subdir.txt\n+++ /dev/null\n@@ -1,2 +0,0 @@\n-Is it a bird?\n-Is it a plane?\n";
@@ -122,20 +122,20 @@ void test_diff_patch__to_string(void)
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected, text);
- cl_assert_equal_sz(31, git_diff_patch_size(patch, 0, 0, 0));
- cl_assert_equal_sz(31, git_diff_patch_size(patch, 1, 0, 0));
- cl_assert_equal_sz(31 + 16, git_diff_patch_size(patch, 1, 1, 0));
- cl_assert_equal_sz(strlen(expected), git_diff_patch_size(patch, 1, 1, 1));
+ cl_assert_equal_sz(31, git_patch_size(patch, 0, 0, 0));
+ cl_assert_equal_sz(31, git_patch_size(patch, 1, 0, 0));
+ cl_assert_equal_sz(31 + 16, git_patch_size(patch, 1, 1, 0));
+ cl_assert_equal_sz(strlen(expected), git_patch_size(patch, 1, 1, 1));
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
git_tree_free(another);
git_tree_free(one);
}
@@ -145,8 +145,8 @@ void test_diff_patch__config_options(void)
const char *one_sha = "26a125e"; /* current HEAD */
git_tree *one;
git_config *cfg;
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
char *text;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
char *onefile = "staged_changes_modified_file";
@@ -167,24 +167,24 @@ void test_diff_patch__config_options(void)
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, one, NULL, &opts));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected1, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected2, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
cl_git_pass(git_config_set_string(cfg, "diff.noprefix", "true"));
@@ -192,13 +192,13 @@ void test_diff_patch__config_options(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected3, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
cl_git_pass(git_config_set_int32(cfg, "core.abbrev", 12));
@@ -206,13 +206,13 @@ void test_diff_patch__config_options(void)
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, one, NULL, &opts));
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 0));
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 0));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected4, text);
git__free(text);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
git_tree_free(one);
git_config_free(cfg);
@@ -223,10 +223,10 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
git_config *cfg;
git_tree *head;
git_diff_options opt = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
const git_diff_delta *delta;
- const git_diff_range *range;
+ const git_diff_hunk *range;
const char *hdr, *text;
size_t hdrlen, hunklen, textlen;
char origin;
@@ -253,15 +253,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
- cl_assert_equal_i(2, (int)git_diff_patch_num_hunks(patch));
+ cl_assert_equal_i(2, (int)git_patch_num_hunks(patch));
/* check hunk 0 */
cl_git_pass(
- git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
+ git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
cl_assert_equal_i(18, (int)hunklen);
@@ -270,9 +270,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(6, (int)range->new_start);
cl_assert_equal_i(9, (int)range->new_lines);
- cl_assert_equal_i(18, (int)git_diff_patch_num_lines_in_hunk(patch, 0));
+ cl_assert_equal_i(18, (int)git_patch_num_lines_in_hunk(patch, 0));
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 0));
cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -280,7 +280,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(6, oldno);
cl_assert_equal_i(6, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -288,7 +288,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(9, oldno);
cl_assert_equal_i(-1, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -299,7 +299,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
/* check hunk 1 */
cl_git_pass(
- git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 1));
+ git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 1));
cl_assert_equal_i(18, (int)hunklen);
@@ -308,9 +308,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(25, (int)range->new_start);
cl_assert_equal_i(9, (int)range->new_lines);
- cl_assert_equal_i(18, (int)git_diff_patch_num_lines_in_hunk(patch, 1));
+ cl_assert_equal_i(18, (int)git_patch_num_lines_in_hunk(patch, 1));
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 1, 0));
cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -318,7 +318,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(31, oldno);
cl_assert_equal_i(25, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 1, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -326,7 +326,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(34, oldno);
cl_assert_equal_i(-1, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 1, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -334,8 +334,8 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(-1, oldno);
cl_assert_equal_i(28, newno);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
/* Let's check line numbers when there is no newline */
@@ -346,15 +346,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
- cl_assert_equal_i(1, (int)git_diff_patch_num_hunks(patch));
+ cl_assert_equal_i(1, (int)git_patch_num_hunks(patch));
/* check hunk 0 */
cl_git_pass(
- git_diff_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
+ git_patch_get_hunk(&range, &hdr, &hdrlen, &hunklen, patch, 0));
cl_assert_equal_i(6, (int)hunklen);
@@ -363,9 +363,9 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(46, (int)range->new_start);
cl_assert_equal_i(4, (int)range->new_lines);
- cl_assert_equal_i(6, (int)git_diff_patch_num_lines_in_hunk(patch, 0));
+ cl_assert_equal_i(6, (int)git_patch_num_lines_in_hunk(patch, 0));
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 1));
cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -373,7 +373,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(47, oldno);
cl_assert_equal_i(47, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 2));
cl_assert_equal_i(GIT_DIFF_LINE_CONTEXT, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -381,7 +381,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(48, oldno);
cl_assert_equal_i(48, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -389,7 +389,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(49, oldno);
cl_assert_equal_i(-1, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 4));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -397,7 +397,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(-1, oldno);
cl_assert_equal_i(49, newno);
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &text, &textlen, &oldno, &newno, patch, 0, 5));
cl_assert_equal_i(GIT_DIFF_LINE_DEL_EOFNL, (int)origin);
cl_git_pass(git_buf_set(&actual, text, textlen));
@@ -405,8 +405,8 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_i(-1, oldno);
cl_assert_equal_i(49, newno);
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
git_buf_free(&actual);
git_buf_free(&old_content);
@@ -418,8 +418,8 @@ static void check_single_patch_stats(
size_t adds, size_t dels, size_t ctxt, size_t *sizes,
const char *expected)
{
- git_diff_list *diff;
- git_diff_patch *patch;
+ git_diff *diff;
+ git_patch *patch;
const git_diff_delta *delta;
size_t actual_ctxt, actual_adds, actual_dels;
@@ -427,12 +427,12 @@ static void check_single_patch_stats(
cl_assert_equal_i(1, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
- cl_assert_equal_i((int)hunks, (int)git_diff_patch_num_hunks(patch));
+ cl_assert_equal_i((int)hunks, (int)git_patch_num_hunks(patch));
- cl_git_pass( git_diff_patch_line_stats(
+ cl_git_pass( git_patch_line_stats(
&actual_ctxt, &actual_adds, &actual_dels, patch) );
cl_assert_equal_sz(ctxt, actual_ctxt);
@@ -441,21 +441,21 @@ static void check_single_patch_stats(
if (expected != NULL) {
char *text;
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected, text);
git__free(text);
cl_assert_equal_sz(
- strlen(expected), git_diff_patch_size(patch, 1, 1, 1));
+ strlen(expected), git_patch_size(patch, 1, 1, 1));
}
if (sizes) {
if (sizes[0])
- cl_assert_equal_sz(sizes[0], git_diff_patch_size(patch, 0, 0, 0));
+ cl_assert_equal_sz(sizes[0], git_patch_size(patch, 0, 0, 0));
if (sizes[1])
- cl_assert_equal_sz(sizes[1], git_diff_patch_size(patch, 1, 0, 0));
+ cl_assert_equal_sz(sizes[1], git_patch_size(patch, 1, 0, 0));
if (sizes[2])
- cl_assert_equal_sz(sizes[2], git_diff_patch_size(patch, 1, 1, 0));
+ cl_assert_equal_sz(sizes[2], git_patch_size(patch, 1, 1, 0));
}
/* walk lines in hunk with basic sanity checks */
@@ -464,12 +464,12 @@ static void check_single_patch_stats(
int lastoldno = -1, oldno, lastnewno = -1, newno;
char origin;
- max_i = git_diff_patch_num_lines_in_hunk(patch, hunks - 1);
+ max_i = git_patch_num_lines_in_hunk(patch, hunks - 1);
for (i = 0; i < max_i; ++i) {
int expected = 1;
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, NULL, NULL, &oldno, &newno, patch, hunks - 1, i));
if (origin == GIT_DIFF_LINE_ADD_EOFNL ||
@@ -490,8 +490,8 @@ static void check_single_patch_stats(
}
}
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ git_patch_free(patch);
+ git_diff_free(diff);
}
void test_diff_patch__line_counts_with_eofnl(void)
diff --git a/tests-clar/diff/pathspec.c b/tests-clar/diff/pathspec.c
index 7b15ea04c..5761d2d2b 100644
--- a/tests-clar/diff/pathspec.c
+++ b/tests-clar/diff/pathspec.c
@@ -20,7 +20,7 @@ void test_diff_pathspec__0(void)
git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
git_tree *b = resolve_commit_oid_to_tree(g_repo, b_commit);
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
git_strarray paths = { NULL, 1 };
char *path;
git_pathspec *ps;
@@ -52,7 +52,7 @@ void test_diff_pathspec__0(void)
(int)git_pathspec_match_list_diff_entry(matches,0)->status);
git_pathspec_match_list_free(matches);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
cl_git_pass(git_diff_tree_to_tree(&diff, g_repo, a, b, &opts));
@@ -68,7 +68,7 @@ void test_diff_pathspec__0(void)
(int)git_pathspec_match_list_diff_entry(matches,0)->status);
git_pathspec_match_list_free(matches);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, a, &opts));
@@ -84,7 +84,7 @@ void test_diff_pathspec__0(void)
(int)git_pathspec_match_list_diff_entry(matches,0)->status);
git_pathspec_match_list_free(matches);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
git_tree_free(a);
diff --git a/tests-clar/diff/rename.c b/tests-clar/diff/rename.c
index 9864c5896..45706fb47 100644
--- a/tests-clar/diff/rename.c
+++ b/tests-clar/diff/rename.c
@@ -43,7 +43,7 @@ void test_diff_rename__match_oid(void)
const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
git_tree *old_tree, *new_tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -88,7 +88,7 @@ void test_diff_rename__match_oid(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_diff_tree_to_tree(
&diff, g_repo, old_tree, new_tree, &diffopts));
@@ -109,7 +109,7 @@ void test_diff_rename__match_oid(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(old_tree);
git_tree_free(new_tree);
@@ -120,7 +120,7 @@ void test_diff_rename__checks_options_version(void)
const char *old_sha = "31e47d8c1fa36d7f8d537b96158e3f024de0a9f2";
const char *new_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
git_tree *old_tree, *new_tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
const git_error *err;
@@ -142,7 +142,7 @@ void test_diff_rename__checks_options_version(void)
err = giterr_last();
cl_assert_equal_i(GITERR_INVALID, err->klass);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(old_tree);
git_tree_free(new_tree);
}
@@ -153,7 +153,7 @@ void test_diff_rename__not_exact_match(void)
const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
const char *sha2 = "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13";
git_tree *old_tree, *new_tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -207,7 +207,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* git diff -M -C \
* 2bc7f351d20b53f1c72c16c4b036e491c478c49a \
@@ -228,7 +228,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* git diff -M -C --find-copies-harder --break-rewrites \
* 2bc7f351d20b53f1c72c16c4b036e491c478c49a \
@@ -253,7 +253,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_COPIED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* == Changes =====================================================
* songofseven.txt -> untimely.txt (rename, convert to crlf)
@@ -281,7 +281,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* git diff -M -C \
* 1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -301,7 +301,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* git diff -M -C --find-copies-harder --break-rewrites \
* 1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -330,7 +330,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* git diff -M -C --find-copies-harder --break-rewrites \
* 1c068dee5790ef1580cfc4cd670915b48d790084 \
@@ -353,7 +353,7 @@ void test_diff_rename__not_exact_match(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(old_tree);
git_tree_free(new_tree);
@@ -364,7 +364,7 @@ void test_diff_rename__handles_small_files(void)
const char *tree_sha = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -388,7 +388,7 @@ void test_diff_rename__handles_small_files(void)
GIT_DIFF_FIND_AND_BREAK_REWRITES;
cl_git_pass(git_diff_find_similar(diff, &opts));
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
}
@@ -400,7 +400,7 @@ void test_diff_rename__working_directory_changes(void)
git_oid id;
git_tree *tree;
git_blob *blob;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -451,7 +451,7 @@ void test_diff_rename__working_directory_changes(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* rewrite files in the working directory with / without CRLF changes */
@@ -477,7 +477,7 @@ void test_diff_rename__working_directory_changes(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* try a different whitespace option */
@@ -496,7 +496,7 @@ void test_diff_rename__working_directory_changes(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* try a different matching option */
@@ -514,7 +514,7 @@ void test_diff_rename__working_directory_changes(void)
cl_assert_equal_i(3, exp.file_status[GIT_DELTA_UNTRACKED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_DELETED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* again with exact match blob */
@@ -545,7 +545,7 @@ void test_diff_rename__working_directory_changes(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_buf_free(&content);
@@ -557,10 +557,10 @@ void test_diff_rename__patch(void)
const char *sha0 = "2bc7f351d20b53f1c72c16c4b036e491c478c49a";
const char *sha1 = "1c068dee5790ef1580cfc4cd670915b48d790084";
git_tree *old_tree, *new_tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
- git_diff_patch *patch;
+ git_patch *patch;
const git_diff_delta *delta;
char *text;
const char *expected = "diff --git a/sixserving.txt b/ikeepsix.txt\nindex ad0a8e5..36020db 100644\n--- a/sixserving.txt\n+++ b/ikeepsix.txt\n@@ -1,3 +1,6 @@\n+I Keep Six Honest Serving-Men\n+=============================\n+\n I KEEP six honest serving-men\n (They taught me all I knew);\n Their names are What and Why and When\n@@ -21,4 +24,4 @@ She sends'em abroad on her own affairs,\n One million Hows, two million Wheres,\n And seven million Whys!\n \n- -- Rudyard Kipling\n+ -- Rudyard Kipling\n";
@@ -584,25 +584,25 @@ void test_diff_rename__patch(void)
cl_assert_equal_i(4, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_COPIED, (int)delta->status);
- cl_git_pass(git_diff_patch_to_str(&text, patch));
+ cl_git_pass(git_patch_to_str(&text, patch));
cl_assert_equal_s(expected, text);
git__free(text);
- git_diff_patch_free(patch);
+ git_patch_free(patch);
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 1));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 1));
cl_assert_equal_i(GIT_DELTA_UNMODIFIED, (int)delta->status);
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 2));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 2));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 3));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 3));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(old_tree);
git_tree_free(new_tree);
}
@@ -612,7 +612,7 @@ void test_diff_rename__file_exchange(void)
git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -647,7 +647,7 @@ void test_diff_rename__file_exchange(void)
cl_assert_equal_i(2, exp.files);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
@@ -660,7 +660,7 @@ void test_diff_rename__file_exchange_three(void)
git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT, c3 = GIT_BUF_INIT;
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -699,7 +699,7 @@ void test_diff_rename__file_exchange_three(void)
cl_assert_equal_i(3, exp.files);
cl_assert_equal_i(3, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
@@ -713,7 +713,7 @@ void test_diff_rename__file_partial_exchange(void)
git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -752,7 +752,7 @@ void test_diff_rename__file_partial_exchange(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
@@ -765,7 +765,7 @@ void test_diff_rename__rename_and_copy_from_same_source(void)
git_buf c1 = GIT_BUF_INIT, c2 = GIT_BUF_INIT;
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -809,7 +809,7 @@ void test_diff_rename__rename_and_copy_from_same_source(void)
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_COPIED]);
cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNMODIFIED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
@@ -822,7 +822,7 @@ void test_diff_rename__from_deleted_to_split(void)
git_buf c1 = GIT_BUF_INIT;
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
diff_expects exp;
@@ -863,7 +863,7 @@ void test_diff_rename__from_deleted_to_split(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNMODIFIED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
@@ -907,7 +907,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
git_index *index;
git_tree *tree;
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
git_buf one = GIT_BUF_INIT, two = GIT_BUF_INIT;
@@ -961,7 +961,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
cl_git_pass(
git_diff_foreach(diff, test_names_expected, NULL, NULL, &expect));
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
git_reference_free(head);
@@ -993,7 +993,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
git_index *index;
git_tree *tree;
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
unsigned int status[] = { GIT_DELTA_RENAMED, GIT_DELTA_RENAMED };
@@ -1035,7 +1035,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
git_diff_foreach(diff, test_names_expected, NULL, NULL, &expect));
cl_assert(expect.idx > 0);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
git_reference_free(head);
@@ -1048,7 +1048,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
git_index *index;
git_tree *tree;
git_checkout_opts opts = GIT_CHECKOUT_OPTS_INIT;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1091,7 +1091,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
cl_assert(expect.idx == expect.len);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
git_reference_free(head);
@@ -1102,7 +1102,7 @@ void test_diff_rename__can_rename_from_rewrite(void)
{
git_index *index;
git_tree *tree;
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1140,7 +1140,7 @@ void test_diff_rename__can_rename_from_rewrite(void)
cl_assert(expect.idx == expect.len);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(tree);
git_index_free(index);
}
@@ -1149,7 +1149,7 @@ void test_diff_rename__case_changes_are_split(void)
{
git_index *index;
git_tree *tree;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1182,7 +1182,7 @@ void test_diff_rename__case_changes_are_split(void)
cl_assert_equal_i(1, exp.files);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_index_free(index);
git_tree_free(tree);
}
@@ -1191,7 +1191,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
{
git_index *index;
git_tree *tree;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options opts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1230,7 +1230,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
cl_assert_equal_i(1, exp.files);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_RENAMED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_index_free(index);
git_tree_free(tree);
}
@@ -1238,7 +1238,7 @@ void test_diff_rename__unmodified_can_be_renamed(void)
void test_diff_rename__rewrite_on_single_file(void)
{
git_index *index;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
git_diff_options diffopts = GIT_DIFF_OPTIONS_INIT;
git_diff_find_options findopts = GIT_DIFF_FIND_OPTIONS_INIT;
@@ -1280,6 +1280,6 @@ void test_diff_rename__rewrite_on_single_file(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_index_free(index);
}
diff --git a/tests-clar/diff/submodules.c b/tests-clar/diff/submodules.c
index 036ff09aa..24283e2fa 100644
--- a/tests-clar/diff/submodules.c
+++ b/tests-clar/diff/submodules.c
@@ -14,15 +14,15 @@ void test_diff_submodules__cleanup(void)
}
static void check_diff_patches_at_line(
- git_diff_list *diff, const char **expected, const char *file, int line)
+ git_diff *diff, const char **expected, const char *file, int line)
{
const git_diff_delta *delta;
- git_diff_patch *patch = NULL;
+ git_patch *patch = NULL;
size_t d, num_d = git_diff_num_deltas(diff);
char *patch_text;
- for (d = 0; d < num_d; ++d, git_diff_patch_free(patch)) {
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ for (d = 0; d < num_d; ++d, git_patch_free(patch)) {
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
if (delta->status == GIT_DELTA_UNMODIFIED) {
cl_assert_at_line(expected[d] == NULL, file, line);
@@ -32,11 +32,11 @@ static void check_diff_patches_at_line(
if (expected[d] && !strcmp(expected[d], "<SKIP>"))
continue;
if (expected[d] && !strcmp(expected[d], "<END>")) {
- cl_git_pass(git_diff_patch_to_str(&patch_text, patch));
+ cl_git_pass(git_patch_to_str(&patch_text, patch));
cl_assert_at_line(!strcmp(expected[d], "<END>"), file, line);
}
- cl_git_pass(git_diff_patch_to_str(&patch_text, patch));
+ cl_git_pass(git_patch_to_str(&patch_text, patch));
clar__assert_equal(
file, line, "expected diff did not match actual diff", 1,
@@ -53,7 +53,7 @@ static void check_diff_patches_at_line(
void test_diff_submodules__unmodified_submodule(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
static const char *expected[] = {
"<SKIP>", /* .gitmodules */
NULL, /* added */
@@ -74,13 +74,13 @@ void test_diff_submodules__unmodified_submodule(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_submodules__dirty_submodule(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
static const char *expected[] = {
"<SKIP>", /* .gitmodules */
NULL, /* added */
@@ -104,13 +104,13 @@ void test_diff_submodules__dirty_submodule(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_submodules__dirty_submodule_2(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL, *diff2 = NULL;
+ git_diff *diff = NULL, *diff2 = NULL;
char *smpath = "testrepo";
static const char *expected_none[] = { "<END>" };
static const char *expected_dirty[] = {
@@ -132,7 +132,7 @@ void test_diff_submodules__dirty_submodule_2(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_none);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_rewritefile("submodules/testrepo/README", "heyheyhey");
cl_git_mkfile("submodules/testrepo/all_new.txt", "never seen before");
@@ -146,25 +146,25 @@ void test_diff_submodules__dirty_submodule_2(void)
cl_git_pass(git_repository_head_tree(&head, g_repo));
cl_git_pass(git_diff_tree_to_index(&diff2, g_repo, head, NULL, &opts));
cl_git_pass(git_diff_merge(diff, diff2));
- git_diff_list_free(diff2);
+ git_diff_free(diff2);
git_tree_free(head);
check_diff_patches(diff, expected_dirty);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_submodule_reload_all(g_repo));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_submodules__submod2_index_to_wd(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
static const char *expected[] = {
"<SKIP>", /* .gitmodules */
"diff --git a/sm_changed_file b/sm_changed_file\nindex 4800958..4800958 160000\n--- a/sm_changed_file\n+++ b/sm_changed_file\n@@ -1 +1 @@\n-Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0\n+Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0-dirty\n", /* sm_changed_file */
@@ -182,14 +182,14 @@ void test_diff_submodules__submod2_index_to_wd(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_submodules__submod2_head_to_index(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_tree *head;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
static const char *expected[] = {
"<SKIP>", /* .gitmodules */
"diff --git a/sm_added_and_uncommited b/sm_added_and_uncommited\nnew file mode 160000\nindex 0000000..4800958\n--- /dev/null\n+++ b/sm_added_and_uncommited\n@@ -0,0 +1 @@\n+Subproject commit 480095882d281ed676fe5b863569520e54a7d5c0\n", /* sm_added_and_uncommited */
@@ -205,7 +205,7 @@ void test_diff_submodules__submod2_head_to_index(void)
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, head, NULL, &opts));
check_diff_patches(diff, expected);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(head);
}
@@ -213,7 +213,7 @@ void test_diff_submodules__submod2_head_to_index(void)
void test_diff_submodules__invalid_cache(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
git_submodule *sm;
char *smpath = "sm_changed_head";
git_repository *smrepo;
@@ -246,7 +246,7 @@ void test_diff_submodules__invalid_cache(void)
/* baseline */
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_baseline);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* update index with new HEAD */
cl_git_pass(git_submodule_lookup(&sm, g_repo, smpath));
@@ -254,7 +254,7 @@ void test_diff_submodules__invalid_cache(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_unchanged);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* create untracked file in submodule working directory */
cl_git_mkfile("submod2/sm_changed_head/new_around_here", "hello");
@@ -262,13 +262,13 @@ void test_diff_submodules__invalid_cache(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_UNTRACKED);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_unchanged);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* modify tracked file in submodule working directory */
cl_git_append2file(
@@ -276,20 +276,20 @@ void test_diff_submodules__invalid_cache(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_submodule_reload_all(g_repo));
cl_git_pass(git_submodule_lookup(&sm, g_repo, smpath));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_DIRTY);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_unchanged);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* add file to index in submodule */
cl_git_pass(git_submodule_open(&smrepo, sm));
@@ -300,13 +300,13 @@ void test_diff_submodules__invalid_cache(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_DIRTY);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_unchanged);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* commit changed index of submodule */
cl_repo_commit_from_index(NULL, smrepo, NULL, 1372350000, "Move it");
@@ -315,25 +315,25 @@ void test_diff_submodules__invalid_cache(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_moved);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_ALL);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_unchanged);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_submodule_set_ignore(sm, GIT_SUBMODULE_IGNORE_NONE);
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_moved_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
p_unlink("submod2/sm_changed_head/new_around_here");
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_moved);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_index_free(smindex);
git_repository_free(smrepo);
@@ -342,7 +342,7 @@ void test_diff_submodules__invalid_cache(void)
void test_diff_submodules__diff_ignore_options(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
git_config *cfg;
static const char *expected_normal[] = {
"<SKIP>", /* .gitmodules */
@@ -371,26 +371,26 @@ void test_diff_submodules__diff_ignore_options(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_normal);
- git_diff_list_free(diff);
+ git_diff_free(diff);
opts.flags |= GIT_DIFF_IGNORE_SUBMODULES;
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_ignore_all);
- git_diff_list_free(diff);
+ git_diff_free(diff);
opts.flags &= ~GIT_DIFF_IGNORE_SUBMODULES;
opts.ignore_submodules = GIT_SUBMODULE_IGNORE_ALL;
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_ignore_all);
- git_diff_list_free(diff);
+ git_diff_free(diff);
opts.ignore_submodules = GIT_SUBMODULE_IGNORE_DIRTY;
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_ignore_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
opts.ignore_submodules = 0;
cl_git_pass(git_repository_config(&cfg, g_repo));
@@ -398,25 +398,25 @@ void test_diff_submodules__diff_ignore_options(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_normal);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_config_set_bool(cfg, "diff.ignoreSubmodules", true));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_ignore_all);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "none"));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_normal);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_pass(git_config_set_string(cfg, "diff.ignoreSubmodules", "dirty"));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_ignore_dirty);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_config_free(cfg);
}
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c
index f05c7869e..7286ee121 100644
--- a/tests-clar/diff/tree.c
+++ b/tests-clar/diff/tree.c
@@ -3,7 +3,7 @@
static git_repository *g_repo = NULL;
static git_diff_options opts;
-static git_diff_list *diff;
+static git_diff *diff;
static git_tree *a, *b;
static diff_expects expect;
@@ -22,7 +22,7 @@ void test_diff_tree__initialize(void)
void test_diff_tree__cleanup(void)
{
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(a);
git_tree_free(b);
@@ -65,7 +65,7 @@ void test_diff_tree__0(void)
cl_assert_equal_i(24 + 1 + 5 + 5, expect.line_adds);
cl_assert_equal_i(7 + 1, expect.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
memset(&expect, 0, sizeof(expect));
@@ -168,7 +168,7 @@ void test_diff_tree__options(void)
cl_assert_equal_i(actual.line_adds, expected->line_adds);
cl_assert_equal_i(actual.line_dels, expected->line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
}
@@ -214,7 +214,7 @@ void test_diff_tree__merge(void)
const char *b_commit = "370fe9ec22";
const char *c_commit = "f5b0af1fb4f5c";
git_tree *c;
- git_diff_list *diff1 = NULL, *diff2 = NULL;
+ git_diff *diff1 = NULL, *diff2 = NULL;
g_repo = cl_git_sandbox_init("attr");
@@ -230,7 +230,7 @@ void test_diff_tree__merge(void)
cl_git_pass(git_diff_merge(diff1, diff2));
- git_diff_list_free(diff2);
+ git_diff_free(diff2);
cl_git_pass(git_diff_foreach(
diff1, diff_file_cb, diff_hunk_cb, diff_line_cb, &expect));
@@ -247,7 +247,7 @@ void test_diff_tree__merge(void)
cl_assert_equal_i(36, expect.line_adds);
cl_assert_equal_i(22, expect.line_dels);
- git_diff_list_free(diff1);
+ git_diff_free(diff1);
}
void test_diff_tree__larger_hunks(void)
@@ -256,8 +256,8 @@ void test_diff_tree__larger_hunks(void)
const char *b_commit = "7a9e0b02e63179929fed24f0a3e0f19168114d10";
size_t d, num_d, h, num_h, l, num_l, header_len, line_len;
const git_diff_delta *delta;
- git_diff_patch *patch;
- const git_diff_range *range;
+ git_patch *patch;
+ const git_diff_hunk *range;
const char *header, *line;
char origin;
@@ -273,31 +273,31 @@ void test_diff_tree__larger_hunks(void)
num_d = git_diff_num_deltas(diff);
for (d = 0; d < num_d; ++d) {
- cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, &delta, diff, d));
cl_assert(patch && delta);
- num_h = git_diff_patch_num_hunks(patch);
+ num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
- cl_git_pass(git_diff_patch_get_hunk(
+ cl_git_pass(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, h));
for (l = 0; l < num_l; ++l) {
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &line, &line_len, NULL, NULL, patch, h, l));
cl_assert(line);
}
- cl_git_fail(git_diff_patch_get_line_in_hunk(
+ cl_git_fail(git_patch_get_line_in_hunk(
&origin, &line, &line_len, NULL, NULL, patch, h, num_l));
}
- cl_git_fail(git_diff_patch_get_hunk(
+ cl_git_fail(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, num_h));
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
- cl_git_fail(git_diff_get_patch(&patch, &delta, diff, num_d));
+ cl_git_fail(git_patch_from_diff(&patch, &delta, diff, num_d));
cl_assert_equal_i(2, (int)num_d);
}
@@ -487,7 +487,7 @@ void test_diff_tree__diff_configs(void)
cl_assert_equal_i(7, expect.line_adds);
cl_assert_equal_i(15, expect.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
set_config_int(g_repo, "diff.context", 1);
@@ -507,7 +507,7 @@ void test_diff_tree__diff_configs(void)
cl_assert_equal_i(7, expect.line_adds);
cl_assert_equal_i(15, expect.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
set_config_int(g_repo, "diff.context", 0);
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index aeef7b963..4af667196 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -16,7 +16,7 @@ void test_diff_workdir__cleanup(void)
void test_diff_workdir__to_index(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
int use_iterator;
@@ -60,7 +60,7 @@ void test_diff_workdir__to_index(void)
cl_assert_equal_i(5, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__to_tree(void)
@@ -70,8 +70,8 @@ void test_diff_workdir__to_tree(void)
const char *b_commit = "0017bd4ab1ec3"; /* the start */
git_tree *a, *b;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
- git_diff_list *diff2 = NULL;
+ git_diff *diff = NULL;
+ git_diff *diff2 = NULL;
diff_expects exp;
int use_iterator;
@@ -119,7 +119,7 @@ void test_diff_workdir__to_tree(void)
* do more apples-to-apples test comparison below.
*/
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
memset(&exp, 0, sizeof(exp));
@@ -130,7 +130,7 @@ void test_diff_workdir__to_tree(void)
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
cl_git_pass(git_diff_merge(diff, diff2));
- git_diff_list_free(diff2);
+ git_diff_free(diff2);
for (use_iterator = 0; use_iterator <= 1; use_iterator++) {
memset(&exp, 0, sizeof(exp));
@@ -157,7 +157,7 @@ void test_diff_workdir__to_tree(void)
cl_assert_equal_i(5, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
memset(&exp, 0, sizeof(exp));
@@ -167,7 +167,7 @@ void test_diff_workdir__to_tree(void)
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, b, NULL, &opts));
cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
cl_git_pass(git_diff_merge(diff, diff2));
- git_diff_list_free(diff2);
+ git_diff_free(diff2);
for (use_iterator = 0; use_iterator <= 1; use_iterator++) {
memset(&exp, 0, sizeof(exp));
@@ -194,7 +194,7 @@ void test_diff_workdir__to_tree(void)
cl_assert_equal_i(4, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(a);
git_tree_free(b);
@@ -203,7 +203,7 @@ void test_diff_workdir__to_tree(void)
void test_diff_workdir__to_index_with_pathspec(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
char *pathspec = NULL;
int use_iterator;
@@ -235,7 +235,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_assert_equal_i(4, exp.file_status[GIT_DELTA_UNTRACKED]);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
pathspec = "modified_file";
@@ -258,7 +258,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
pathspec = "subdir";
@@ -281,7 +281,7 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
pathspec = "*_deleted";
@@ -304,12 +304,12 @@ void test_diff_workdir__to_index_with_pathspec(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_UNTRACKED]);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__filemode_changes(void)
{
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
int use_iterator;
@@ -339,7 +339,7 @@ void test_diff_workdir__filemode_changes(void)
cl_assert_equal_i(0, exp.hunks);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* chmod file and test again */
@@ -362,14 +362,14 @@ void test_diff_workdir__filemode_changes(void)
cl_assert_equal_i(0, exp.hunks);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_assert(cl_toggle_filemode("issue_592/a.txt"));
}
void test_diff_workdir__filemode_changes_with_filemode_false(void)
{
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
if (!cl_is_chmod_supported())
@@ -391,7 +391,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* chmod file and test again */
@@ -407,7 +407,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.hunks);
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_assert(cl_toggle_filemode("issue_592/a.txt"));
}
@@ -415,7 +415,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
void test_diff_workdir__head_index_and_workdir_all_differ(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff_i2t = NULL, *diff_w2i = NULL;
+ git_diff *diff_i2t = NULL, *diff_w2i = NULL;
diff_expects exp;
char *pathspec = "staged_changes_modified_file";
git_tree *tree;
@@ -504,8 +504,8 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
cl_assert_equal_i(0, exp.line_dels);
}
- git_diff_list_free(diff_i2t);
- git_diff_list_free(diff_w2i);
+ git_diff_free(diff_i2t);
+ git_diff_free(diff_w2i);
git_tree_free(tree);
}
@@ -513,7 +513,7 @@ void test_diff_workdir__head_index_and_workdir_all_differ(void)
void test_diff_workdir__eof_newline_changes(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
char *pathspec = "current_file";
int use_iterator;
@@ -546,7 +546,7 @@ void test_diff_workdir__eof_newline_changes(void)
cl_assert_equal_i(0, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_append2file("status/current_file", "\n");
@@ -573,7 +573,7 @@ void test_diff_workdir__eof_newline_changes(void)
cl_assert_equal_i(0, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
cl_git_rewritefile("status/current_file", "current_file");
@@ -600,7 +600,7 @@ void test_diff_workdir__eof_newline_changes(void)
cl_assert_equal_i(2, exp.line_dels);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
/* PREPARATION OF TEST DATA
@@ -684,9 +684,9 @@ void test_diff_workdir__larger_hunks(void)
opts.interhunk_lines = 0;
for (i = 0; i <= 2; ++i) {
- git_diff_list *diff = NULL;
- git_diff_patch *patch;
- const git_diff_range *range;
+ git_diff *diff = NULL;
+ git_patch *patch;
+ const git_diff_hunk *range;
const char *header, *line;
char origin;
@@ -707,33 +707,33 @@ void test_diff_workdir__larger_hunks(void)
cl_assert_equal_i(2, (int)num_d);
for (d = 0; d < num_d; ++d) {
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, d));
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, d));
cl_assert(patch);
- num_h = git_diff_patch_num_hunks(patch);
+ num_h = git_patch_num_hunks(patch);
for (h = 0; h < num_h; h++) {
- cl_git_pass(git_diff_patch_get_hunk(
+ cl_git_pass(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, h));
for (l = 0; l < num_l; ++l) {
- cl_git_pass(git_diff_patch_get_line_in_hunk(
+ cl_git_pass(git_patch_get_line_in_hunk(
&origin, &line, &line_len, NULL, NULL, patch, h, l));
cl_assert(line);
}
/* confirm fail after the last item */
- cl_git_fail(git_diff_patch_get_line_in_hunk(
+ cl_git_fail(git_patch_get_line_in_hunk(
&origin, &line, &line_len, NULL, NULL, patch, h, num_l));
}
/* confirm fail after the last item */
- cl_git_fail(git_diff_patch_get_hunk(
+ cl_git_fail(git_patch_get_hunk(
&range, &header, &header_len, &num_l, patch, num_h));
- git_diff_patch_free(patch);
+ git_patch_free(patch);
}
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
git_tree_free(a);
@@ -758,7 +758,7 @@ void test_diff_workdir__submodules(void)
const char *a_commit = "873585b94bdeabccea991ea5e3ec1a277895b698";
git_tree *a;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
g_repo = setup_fixture_submod2();
@@ -819,14 +819,14 @@ void test_diff_workdir__submodules(void)
cl_assert_equal_i(30, exp.line_adds);
cl_assert_equal_i(1, exp.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(a);
}
void test_diff_workdir__cannot_diff_against_a_bare_repository(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
git_tree *tree;
g_repo = cl_git_sandbox_init("testrepo.git");
@@ -844,7 +844,7 @@ void test_diff_workdir__cannot_diff_against_a_bare_repository(void)
void test_diff_workdir__to_null_tree(void)
{
- git_diff_list *diff;
+ git_diff *diff;
diff_expects exp;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
@@ -862,12 +862,12 @@ void test_diff_workdir__to_null_tree(void)
cl_assert_equal_i(exp.files, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__checks_options_version(void)
{
- git_diff_list *diff;
+ git_diff *diff;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
const git_error *err;
@@ -887,11 +887,11 @@ void test_diff_workdir__checks_options_version(void)
void test_diff_workdir__can_diff_empty_file(void)
{
- git_diff_list *diff;
+ git_diff *diff;
git_tree *tree;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
struct stat st;
- git_diff_patch *patch;
+ git_patch *patch;
g_repo = cl_git_sandbox_init("attr_index");
@@ -901,7 +901,7 @@ void test_diff_workdir__can_diff_empty_file(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
cl_assert_equal_i(2, (int)git_diff_num_deltas(diff));
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* empty contents of file */
@@ -912,9 +912,9 @@ void test_diff_workdir__can_diff_empty_file(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));
/* diffs are: .gitattributes, README.txt, sub/sub/.gitattributes */
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 1));
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 1));
+ git_patch_free(patch);
+ git_diff_free(diff);
/* remove a file altogether */
@@ -923,9 +923,9 @@ void test_diff_workdir__can_diff_empty_file(void)
cl_git_pass(git_diff_tree_to_workdir(&diff, g_repo, tree, &opts));
cl_assert_equal_i(3, (int)git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(&patch, NULL, diff, 1));
- git_diff_patch_free(patch);
- git_diff_list_free(diff);
+ cl_git_pass(git_patch_from_diff(&patch, NULL, diff, 1));
+ git_patch_free(patch);
+ git_diff_free(diff);
git_tree_free(tree);
}
@@ -933,7 +933,7 @@ void test_diff_workdir__can_diff_empty_file(void)
void test_diff_workdir__to_index_issue_1397(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
g_repo = cl_git_sandbox_init("issue_1397");
@@ -953,7 +953,7 @@ void test_diff_workdir__to_index_issue_1397(void)
cl_assert_equal_i(0, exp.hunks);
cl_assert_equal_i(0, exp.lines);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
cl_git_rewritefile("issue_1397/crlf_file.txt",
@@ -975,7 +975,7 @@ void test_diff_workdir__to_index_issue_1397(void)
cl_assert_equal_i(1, exp.line_adds);
cl_assert_equal_i(1, exp.line_dels);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__to_tree_issue_1397(void)
@@ -983,8 +983,8 @@ void test_diff_workdir__to_tree_issue_1397(void)
const char *a_commit = "7f483a738"; /* the current HEAD */
git_tree *a;
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
- git_diff_list *diff2 = NULL;
+ git_diff *diff = NULL;
+ git_diff *diff2 = NULL;
diff_expects exp;
g_repo = cl_git_sandbox_init("issue_1397");
@@ -1006,13 +1006,13 @@ void test_diff_workdir__to_tree_issue_1397(void)
cl_assert_equal_i(0, exp.hunks);
cl_assert_equal_i(0, exp.lines);
- git_diff_list_free(diff);
+ git_diff_free(diff);
diff = NULL;
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, NULL, &opts));
cl_git_pass(git_diff_index_to_workdir(&diff2, g_repo, NULL, &opts));
cl_git_pass(git_diff_merge(diff, diff2));
- git_diff_list_free(diff2);
+ git_diff_free(diff2);
memset(&exp, 0, sizeof(exp));
cl_git_pass(git_diff_foreach(
@@ -1022,14 +1022,14 @@ void test_diff_workdir__to_tree_issue_1397(void)
cl_assert_equal_i(0, exp.hunks);
cl_assert_equal_i(0, exp.lines);
- git_diff_list_free(diff);
+ git_diff_free(diff);
git_tree_free(a);
}
void test_diff_workdir__untracked_directory_scenarios(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
diff_expects exp;
char *pathspec = NULL;
static const char *files0[] = {
@@ -1079,7 +1079,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* empty directory */
@@ -1099,7 +1099,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* empty directory in empty directory */
@@ -1119,7 +1119,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* directory with only ignored files */
@@ -1143,7 +1143,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* directory with ignored directory (contents irrelevant) */
@@ -1166,7 +1166,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* quick version avoids directory scan */
@@ -1186,7 +1186,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* directory with nested non-ignored content */
@@ -1209,7 +1209,7 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
/* use RECURSE_UNTRACKED_DIRS to get actual untracked files (no ignores) */
@@ -1230,14 +1230,14 @@ void test_diff_workdir__untracked_directory_scenarios(void)
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(2, exp.file_status[GIT_DELTA_UNTRACKED]);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__untracked_directory_comes_last(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
g_repo = cl_git_sandbox_init("renames");
@@ -1255,13 +1255,13 @@ void test_diff_workdir__untracked_directory_comes_last(void)
cl_assert(diff != NULL);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}
void test_diff_workdir__untracked_with_bom(void)
{
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_diff_list *diff = NULL;
+ git_diff *diff = NULL;
const git_diff_delta *delta;
g_repo = cl_git_sandbox_init("empty_standard_repo");
@@ -1276,9 +1276,9 @@ void test_diff_workdir__untracked_with_bom(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
cl_assert_equal_i(1, git_diff_num_deltas(diff));
- cl_git_pass(git_diff_get_patch(NULL, &delta, diff, 0));
+ cl_git_pass(git_patch_from_diff(NULL, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_UNTRACKED, delta->status);
cl_assert((delta->flags & GIT_DIFF_FLAG_BINARY) != 0);
- git_diff_list_free(diff);
+ git_diff_free(diff);
}