summaryrefslogtreecommitdiff
path: root/tests/libgit2/diff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-23 09:47:01 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-20 17:05:29 -0400
commit3fbf580c91935ccdea25a135204419991f503b63 (patch)
tree53ec861796641faf8895a1f19444c1939ac6be9a /tests/libgit2/diff
parent61838295a055c8c7a4a7eb730538c6e08a38dd6a (diff)
downloadlibgit2-3fbf580c91935ccdea25a135204419991f503b63.tar.gz
oid: give oids a type
`git_oid`s now have a type, and we require the oid type when creating the object id from creation functions.
Diffstat (limited to 'tests/libgit2/diff')
-rw-r--r--tests/libgit2/diff/binary.c10
-rw-r--r--tests/libgit2/diff/blob.c36
-rw-r--r--tests/libgit2/diff/diff_helpers.c2
-rw-r--r--tests/libgit2/diff/format_email.c8
-rw-r--r--tests/libgit2/diff/index.c8
-rw-r--r--tests/libgit2/diff/patchid.c2
-rw-r--r--tests/libgit2/diff/rename.c2
-rw-r--r--tests/libgit2/diff/stats.c2
-rw-r--r--tests/libgit2/diff/workdir.c10
9 files changed, 40 insertions, 40 deletions
diff --git a/tests/libgit2/diff/binary.c b/tests/libgit2/diff/binary.c
index 284a1b1af..e26c370c5 100644
--- a/tests/libgit2/diff/binary.c
+++ b/tests/libgit2/diff/binary.c
@@ -31,12 +31,12 @@ static void test_patch(
git_patch *patch;
git_buf actual = GIT_BUF_INIT;
- cl_git_pass(git_oid_fromstr(&id_one, one));
+ cl_git_pass(git_oid_fromstr(&id_one, one, GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit_one, repo, &id_one));
cl_git_pass(git_commit_tree(&tree_one, commit_one));
if (two) {
- cl_git_pass(git_oid_fromstr(&id_two, two));
+ cl_git_pass(git_oid_fromstr(&id_two, two, GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit_two, repo, &id_two));
cl_git_pass(git_commit_tree(&tree_two, commit_two));
} else {
@@ -289,7 +289,7 @@ void test_diff_binary__empty_for_no_diff(void)
repo = cl_git_sandbox_init("renames");
- cl_git_pass(git_oid_fromstr(&id, "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13"));
+ cl_git_pass(git_oid_fromstr(&id, "19dd32dfb1520a64e5bbaae8dce6ef423dfa2f13", GIT_OID_SHA1));
cl_git_pass(git_commit_lookup(&commit, repo, &id));
cl_git_pass(git_commit_tree(&tree, commit));
@@ -510,8 +510,8 @@ void test_diff_binary__blob_to_blob(void)
cl_git_pass(git_index_add_bypath(index, "untimely.txt"));
cl_git_pass(git_index_write(index));
- git_oid_fromstr(&old_id, "9a69d960ae94b060f56c2a8702545e2bb1abb935");
- git_oid_fromstr(&new_id, "1111d4f11f4b35bf6759e0fb714fe09731ef0840");
+ git_oid_fromstr(&old_id, "9a69d960ae94b060f56c2a8702545e2bb1abb935", GIT_OID_SHA1);
+ git_oid_fromstr(&new_id, "1111d4f11f4b35bf6759e0fb714fe09731ef0840", GIT_OID_SHA1);
cl_git_pass(git_blob_lookup(&old_blob, repo, &old_id));
cl_git_pass(git_blob_lookup(&new_blob, repo, &new_id));
diff --git a/tests/libgit2/diff/blob.c b/tests/libgit2/diff/blob.c
index d2f42207d..f06f884d4 100644
--- a/tests/libgit2/diff/blob.c
+++ b/tests/libgit2/diff/blob.c
@@ -45,11 +45,11 @@ void test_diff_blob__initialize(void)
memset(&expected, 0, sizeof(expected));
/* tests/resources/attr/root_test4.txt */
- cl_git_pass(git_oid_fromstrn(&oid, "a0f7217a", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "a0f7217a", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&d, g_repo, &oid, 8));
/* alien.png */
- cl_git_pass(git_oid_fromstrn(&oid, "edf3dcee", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "edf3dcee", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&alien, g_repo, &oid, 8));
}
@@ -86,10 +86,10 @@ void test_diff_blob__patch_with_freed_blobs(void)
git_buf buf = GIT_BUF_INIT;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
cl_git_pass(git_patch_from_blobs(&p, a, NULL, b, NULL, NULL));
@@ -110,15 +110,15 @@ void test_diff_blob__can_compare_text_blobs(void)
git_oid a_oid, b_oid, c_oid;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 4));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 4));
/* tests/resources/attr/root_test3 */
- cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16));
+ cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&c, g_repo, &c_oid, 16));
/* Doing the equivalent of a `git diff -U1` on these files */
@@ -201,15 +201,15 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
git_patch *p;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* tests/resources/attr/root_test2 */
- cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8));
+ cl_git_pass(git_oid_fromstrn(&b_oid, "4d713dc4", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&b, g_repo, &b_oid, 8));
/* tests/resources/attr/root_test3 */
- cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16));
+ cl_git_pass(git_oid_fromstrn(&c_oid, "c96bbb2c2557a832", 16, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&c, g_repo, &c_oid, 16));
/* Doing the equivalent of a `git diff -U1` on these files */
@@ -475,7 +475,7 @@ void test_diff_blob__can_compare_two_binary_blobs(void)
git_oid h_oid;
/* heart.png */
- cl_git_pass(git_oid_fromstrn(&h_oid, "de863bff", 8));
+ cl_git_pass(git_oid_fromstrn(&h_oid, "de863bff", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&heart, g_repo, &h_oid, 8));
cl_git_pass(git_diff_blobs(
@@ -543,7 +543,7 @@ void test_diff_blob__comparing_two_text_blobs_honors_interhunkcontext(void)
opts.context_lines = 3;
/* tests/resources/attr/root_test1 from commit f5b0af1 */
- cl_git_pass(git_oid_fromstrn(&old_d_oid, "fe773770", 8));
+ cl_git_pass(git_oid_fromstrn(&old_d_oid, "fe773770", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&old_d, g_repo, &old_d_oid, 8));
/* Test with default inter-hunk-context (not set) => default is 0 */
@@ -652,7 +652,7 @@ void test_diff_blob__can_compare_blob_to_buffer(void)
const char *b_content = "Hello from the root\n\nSome additional lines\n\nDown here below\n\n";
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* diff from blob a to content of b */
@@ -694,7 +694,7 @@ void test_diff_blob__can_compare_blob_to_buffer_with_patch(void)
size_t tc, ta, td;
/* tests/resources/attr/root_test1 */
- cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&a_oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&a, g_repo, &a_oid, 8));
/* diff from blob a to content of b */
@@ -773,10 +773,10 @@ void test_diff_blob__binary_data_comparisons(void)
opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
- cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&nonbin, g_repo, &oid, 8));
- cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&bin, g_repo, &oid, 8));
/* non-binary to reference content */
@@ -879,11 +879,11 @@ void test_diff_blob__using_path_and_attributes(void)
opts.context_lines = 0;
opts.flags |= GIT_DIFF_INCLUDE_UNMODIFIED;
- cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "45141a79", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&nonbin, g_repo, &oid, 8));
/* 20b: "Hello from the root\n" */
- cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8));
+ cl_git_pass(git_oid_fromstrn(&oid, "b435cd56", 8, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup_prefix(&bin, g_repo, &oid, 8));
/* 33b: "0123456789\n\x01\x02\x03\x04\x05\x06\x07\x08\x09\n0123456789\n" */
diff --git a/tests/libgit2/diff/diff_helpers.c b/tests/libgit2/diff/diff_helpers.c
index e9900339f..ae23c48b7 100644
--- a/tests/libgit2/diff/diff_helpers.c
+++ b/tests/libgit2/diff/diff_helpers.c
@@ -11,7 +11,7 @@ git_tree *resolve_commit_oid_to_tree(
git_object *obj = NULL;
git_tree *tree = NULL;
- if (git_oid_fromstrn(&oid, partial_oid, len) == 0)
+ if (git_oid_fromstrn(&oid, partial_oid, len, GIT_OID_SHA1) == 0)
cl_git_pass(git_object_lookup_prefix(&obj, repo, &oid, len, GIT_OBJECT_ANY));
cl_git_pass(git_object_peel((git_object **) &tree, obj, GIT_OBJECT_TREE));
diff --git a/tests/libgit2/diff/format_email.c b/tests/libgit2/diff/format_email.c
index 612804c42..db431783f 100644
--- a/tests/libgit2/diff/format_email.c
+++ b/tests/libgit2/diff/format_email.c
@@ -28,7 +28,7 @@ static void assert_email_match(
git_diff *diff = NULL;
git_buf buf = GIT_BUF_INIT;
- git_oid_fromstr(&oid, oidstr);
+ git_oid_fromstr(&oid, oidstr, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
@@ -228,7 +228,7 @@ void test_diff_format_email__multiple(void)
"\n";
- git_oid_fromstr(&oid, "10808fe9c9be5a190c0ba68d1a002233fb363508");
+ git_oid_fromstr(&oid, "10808fe9c9be5a190c0ba68d1a002233fb363508", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
opts.id = git_commit_id(commit);
@@ -245,7 +245,7 @@ void test_diff_format_email__multiple(void)
diff = NULL;
commit = NULL;
- git_oid_fromstr(&oid, "873806f6f27e631eb0b23e4b56bea2bfac14a373");
+ git_oid_fromstr(&oid, "873806f6f27e631eb0b23e4b56bea2bfac14a373", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
opts.id = git_commit_id(commit);
@@ -324,7 +324,7 @@ void test_diff_format_email__invalid_no(void)
git_diff_format_email_options opts = GIT_DIFF_FORMAT_EMAIL_OPTIONS_INIT;
git_buf buf = GIT_BUF_INIT;
- git_oid_fromstr(&oid, "9264b96c6d104d0e07ae33d3007b6a48246c6f92");
+ git_oid_fromstr(&oid, "9264b96c6d104d0e07ae33d3007b6a48246c6f92", GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
diff --git a/tests/libgit2/diff/index.c b/tests/libgit2/diff/index.c
index b616a372b..6b91f8883 100644
--- a/tests/libgit2/diff/index.c
+++ b/tests/libgit2/diff/index.c
@@ -185,9 +185,9 @@ static void do_conflicted_diff(diff_expects *exp, unsigned long flags)
ancestor.path = ours.path = theirs.path = "staged_changes";
ancestor.mode = ours.mode = theirs.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
- git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
+ git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
+ git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, index, &opts));
@@ -255,7 +255,7 @@ void test_diff_index__not_in_head_conflicted(void)
theirs.path = "file_not_in_head";
theirs.mode = GIT_FILEMODE_BLOB;
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, NULL, NULL, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff, g_repo, a, index, NULL));
diff --git a/tests/libgit2/diff/patchid.c b/tests/libgit2/diff/patchid.c
index 621a720f7..a79a425f9 100644
--- a/tests/libgit2/diff/patchid.c
+++ b/tests/libgit2/diff/patchid.c
@@ -6,7 +6,7 @@ static void verify_patch_id(const char *diff_content, const char *expected_id)
git_oid expected_oid, actual_oid;
git_diff *diff;
- cl_git_pass(git_oid_fromstr(&expected_oid, expected_id));
+ cl_git_pass(git_oid_fromstr(&expected_oid, expected_id, GIT_OID_SHA1));
cl_git_pass(git_diff_from_buffer(&diff, diff_content, strlen(diff_content)));
cl_git_pass(git_diff_patchid(&actual_oid, diff, NULL));
diff --git a/tests/libgit2/diff/rename.c b/tests/libgit2/diff/rename.c
index 30e9ea432..69cd062e9 100644
--- a/tests/libgit2/diff/rename.c
+++ b/tests/libgit2/diff/rename.c
@@ -574,7 +574,7 @@ void test_diff_rename__working_directory_changes(void)
/* again with exact match blob */
- cl_git_pass(git_oid_fromstr(&id, blobsha));
+ cl_git_pass(git_oid_fromstr(&id, blobsha, GIT_OID_SHA1));
cl_git_pass(git_blob_lookup(&blob, g_repo, &id));
cl_git_pass(git_str_set(
&content, git_blob_rawcontent(blob), (size_t)git_blob_rawsize(blob)));
diff --git a/tests/libgit2/diff/stats.c b/tests/libgit2/diff/stats.c
index f69dba9b3..b00da123a 100644
--- a/tests/libgit2/diff/stats.c
+++ b/tests/libgit2/diff/stats.c
@@ -26,7 +26,7 @@ static void diff_stats_from_commit_oid(
git_commit *commit;
git_diff *diff;
- git_oid_fromstr(&oid, oidstr);
+ git_oid_fromstr(&oid, oidstr, GIT_OID_SHA1);
cl_git_pass(git_commit_lookup(&commit, _repo, &oid));
cl_git_pass(git_diff__commit(&diff, _repo, commit, NULL));
if (rename)
diff --git a/tests/libgit2/diff/workdir.c b/tests/libgit2/diff/workdir.c
index 20e000906..948ae8ed3 100644
--- a/tests/libgit2/diff/workdir.c
+++ b/tests/libgit2/diff/workdir.c
@@ -86,11 +86,11 @@ void test_diff_workdir__to_index_with_conflicts(void)
/* Adding an entry that represents a rename gets two files in conflict */
our_entry.path = "subdir/modified_file";
our_entry.mode = 0100644;
- git_oid_fromstr(&our_entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
+ git_oid_fromstr(&our_entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
their_entry.path = "subdir/rename_conflict";
their_entry.mode = 0100644;
- git_oid_fromstr(&their_entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid_fromstr(&their_entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_repository_index(&index, g_repo));
cl_git_pass(git_index_conflict_add(index, NULL, &our_entry, &their_entry));
@@ -1979,9 +1979,9 @@ void test_diff_workdir__to_index_conflicted(void) {
ancestor.path = ours.path = theirs.path = "_file";
ancestor.mode = ours.mode = theirs.mode = 0100644;
- git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
- git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
- git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
+ git_oid_fromstr(&ancestor.id, "d427e0b2e138501a3d15cc376077a3631e15bd46", GIT_OID_SHA1);
+ git_oid_fromstr(&ours.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf", GIT_OID_SHA1);
+ git_oid_fromstr(&theirs.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863", GIT_OID_SHA1);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
cl_git_pass(git_diff_tree_to_index(&diff1, g_repo, a, index, NULL));