Commit c1bf2942 by Vicent Marti

Merge pull request #2455 from ethomson/equal_oid

Introduce `cl_assert_equal_oid`
parents 4df4ebd7 9879fee1
......@@ -48,7 +48,7 @@ void check_blame_hunk_index(git_repository *repo, git_blame *blame, int idx,
actual, expected);
}
cl_assert_equal_s(actual, expected);
cl_assert_equal_i(git_oid_cmp(&hunk->final_commit_id, &hunk->orig_commit_id), 0);
cl_assert_equal_oid(&hunk->final_commit_id, &hunk->orig_commit_id);
if (strcmp(hunk->orig_path, orig_path)) {
......
......@@ -37,12 +37,12 @@ static void execute_test(void)
/* Verify that the lenna.jpg file was checked out correctly */
cl_git_pass(git_oid_fromstr(&check, "8ab005d890fe53f65eda14b23672f60d9f4ec5a1"));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/lenna.jpg", GIT_OBJ_BLOB));
cl_assert(git_oid_equal(&oid, &check));
cl_assert_equal_oid(&oid, &check);
/* Verify that the text file was checked out correctly */
cl_git_pass(git_oid_fromstr(&check, "965b223880dd4249e2c66a0cc0b4cffe1dc40f5a"));
cl_git_pass(git_odb_hashfile(&oid, "binaryunicode/utf16_withbom_noeol_crlf.txt", GIT_OBJ_BLOB));
cl_assert(git_oid_equal(&oid, &check));
cl_assert_equal_oid(&oid, &check);
}
void test_checkout_binaryunicode__noautocrlf(void)
......
......@@ -156,7 +156,7 @@ static void ensure_workdir_oid(const char *path, const char *oid_str)
cl_git_pass(git_oid_fromstr(&expected, oid_str));
cl_git_pass(git_repository_hashfile(&actual, g_repo, path, GIT_OBJ_BLOB, NULL));
cl_assert(git_oid_cmp(&expected, &actual) == 0);
cl_assert_equal_oid(&expected, &actual);
}
static void ensure_workdir_mode(const char *path, int mode)
......
......@@ -78,6 +78,24 @@ void clar__assert_equal_file(
const char *file,
int line);
GIT_INLINE(void) clar__assert_equal_oid(
const char *file, int line, const char *desc,
const git_oid *one, const git_oid *two)
{
if (git_oid_cmp(one, two)) {
char err[] = "\"........................................\" != \"........................................\"";
git_oid_fmt(&err[1], one);
git_oid_fmt(&err[47], two);
clar__fail(file, line, desc, err, 1);
}
}
#define cl_assert_equal_oid(one, two) \
clar__assert_equal_oid(__FILE__, __LINE__, \
"OID mismatch: " #one " != " #two, (one), (two))
/*
* Some utility macros for building long strings
*/
......
......@@ -241,7 +241,7 @@ void test_clone_nonetwork__can_detached_head(void)
cl_assert(git_repository_head_detached(cloned));
cl_git_pass(git_repository_head(&cloned_head, cloned));
cl_assert(!git_oid_cmp(git_object_id(obj), git_reference_target(cloned_head)));
cl_assert_equal_oid(git_object_id(obj), git_reference_target(cloned_head));
cl_git_pass(git_reflog_read(&log, cloned, "HEAD"));
entry = git_reflog_entry_byindex(log, 0);
......
......@@ -43,7 +43,7 @@ void test_commit_commit__create_unexisting_update_ref(void)
NULL, "some msg", tree, 1, (const git_commit **) &commit));
cl_git_pass(git_reference_lookup(&ref, _repo, "refs/heads/foo/bar"));
cl_assert(!git_oid_cmp(&oid, git_reference_target(ref)));
cl_assert_equal_oid(&oid, git_reference_target(ref));
git_tree_free(tree);
git_commit_free(commit);
......
......@@ -145,7 +145,7 @@ void test_commit_write__root(void)
cl_assert(git_commit_parentcount(commit) == 0);
cl_git_pass(git_reference_lookup(&branch, g_repo, branch_name));
branch_oid = git_reference_target(branch);
cl_git_pass(git_oid_cmp(branch_oid, &commit_id));
cl_assert_equal_oid(branch_oid, &commit_id);
cl_assert_equal_s(root_commit_message, git_commit_message(commit));
cl_git_pass(git_reflog_read(&log, g_repo, branch_name));
......
......@@ -137,9 +137,9 @@ static void assert_patch_matches_blobs(
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.id));
cl_assert_equal_oid(git_blob_id(a), &delta->old_file.id);
cl_assert_equal_sz(git_blob_rawsize(a), delta->old_file.size);
cl_assert(git_oid_equal(git_blob_id(b), &delta->new_file.id));
cl_assert_equal_oid(git_blob_id(b), &delta->new_file.id);
cl_assert_equal_sz(git_blob_rawsize(b), delta->new_file.size);
cl_assert_equal_i(hunks, (int)git_patch_num_hunks(p));
......@@ -274,7 +274,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
delta = git_patch_get_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.id));
cl_assert_equal_oid(git_blob_id(d), &delta->old_file.id);
cl_assert_equal_sz(git_blob_rawsize(d), delta->old_file.size);
cl_assert(git_oid_iszero(&delta->new_file.id));
cl_assert_equal_sz(0, delta->new_file.size);
......@@ -301,7 +301,7 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
cl_assert_equal_i(GIT_DELTA_ADDED, delta->status);
cl_assert(git_oid_iszero(&delta->old_file.id));
cl_assert_equal_sz(0, delta->old_file.size);
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.id));
cl_assert_equal_oid(git_blob_id(d), &delta->new_file.id);
cl_assert_equal_sz(git_blob_rawsize(d), delta->new_file.size);
cl_assert_equal_i(1, (int)git_patch_num_hunks(p));
......@@ -392,9 +392,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
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));
cl_assert(git_oid_equal(git_blob_id(d), &delta->old_file.id));
cl_assert_equal_oid(git_blob_id(d), &delta->old_file.id);
cl_assert_equal_sz(delta->new_file.size, git_blob_rawsize(d));
cl_assert(git_oid_equal(git_blob_id(d), &delta->new_file.id));
cl_assert_equal_oid(git_blob_id(d), &delta->new_file.id);
cl_assert_equal_i(0, (int)git_patch_num_hunks(p));
git_patch_free(p);
......
......@@ -380,7 +380,7 @@ static void index_iterator_test(
if (expected_oids != NULL) {
git_oid oid;
cl_git_pass(git_oid_fromstr(&oid, expected_oids[count]));
cl_assert_equal_i(git_oid_cmp(&oid, &entry->id), 0);
cl_assert_equal_oid(&oid, &entry->id);
}
count++;
......
......@@ -120,7 +120,7 @@ static int fetchhead_ref_cb(const char *name, const char *url,
expected = git_vector_get(cb_data->fetchhead_vector, cb_data->idx);
cl_assert(git_oid_cmp(&expected->oid, oid) == 0);
cl_assert_equal_oid(&expected->oid, oid);
cl_assert(expected->is_merge == is_merge);
if (expected->ref_name)
......@@ -174,7 +174,7 @@ static int read_old_style_cb(const char *name, const char *url,
cl_assert(name == NULL);
cl_assert(url == NULL);
cl_assert(git_oid_cmp(&expected, oid) == 0);
cl_assert_equal_oid(&expected, oid);
cl_assert(is_merge == 1);
return 0;
......@@ -201,7 +201,7 @@ static int read_type_missing(const char *ref_name, const char *remote_url,
cl_assert_equal_s("name", ref_name);
cl_assert_equal_s("remote_url", remote_url);
cl_assert(git_oid_cmp(&expected, oid) == 0);
cl_assert_equal_oid(&expected, oid);
cl_assert(is_merge == 0);
return 0;
......@@ -228,7 +228,7 @@ static int read_name_missing(const char *ref_name, const char *remote_url,
cl_assert(ref_name == NULL);
cl_assert_equal_s("remote_url", remote_url);
cl_assert(git_oid_cmp(&expected, oid) == 0);
cl_assert_equal_oid(&expected, oid);
cl_assert(is_merge == 0);
return 0;
......
......@@ -107,13 +107,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s("conflicts-one.txt", conflict_entry[0]->path);
git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
cl_assert(git_oid_cmp(&conflict_entry[0]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
git_oid_fromstr(&oid, CONFLICTS_ONE_OUR_OID);
cl_assert(git_oid_cmp(&conflict_entry[1]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
git_oid_fromstr(&oid, CONFLICTS_ONE_THEIR_OID);
cl_assert(git_oid_cmp(&conflict_entry[2]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_git_pass(git_index_conflict_get(&conflict_entry[0], &conflict_entry[1],
&conflict_entry[2], repo_index, "conflicts-two.txt"));
......@@ -121,13 +121,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s("conflicts-two.txt", conflict_entry[0]->path);
git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&conflict_entry[0]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
cl_assert(git_oid_cmp(&conflict_entry[1]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
cl_assert(git_oid_cmp(&conflict_entry[2]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
}
void test_index_conflicts__iterate(void)
......@@ -141,29 +141,29 @@ void test_index_conflicts__iterate(void)
cl_git_pass(git_index_conflict_next(&conflict_entry[0], &conflict_entry[1], &conflict_entry[2], iterator));
git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
cl_assert(git_oid_cmp(&conflict_entry[0]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
git_oid_fromstr(&oid, CONFLICTS_ONE_OUR_OID);
cl_assert(git_oid_cmp(&conflict_entry[1]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
git_oid_fromstr(&oid, CONFLICTS_ONE_THEIR_OID);
cl_assert(git_oid_cmp(&conflict_entry[2]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-one.txt") == 0);
cl_git_pass(git_index_conflict_next(&conflict_entry[0], &conflict_entry[1], &conflict_entry[2], iterator));
git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&conflict_entry[0]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
cl_assert(git_oid_cmp(&conflict_entry[1]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
cl_assert(git_oid_cmp(&conflict_entry[2]->id, &oid) == 0);
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
cl_assert(git__strcmp(conflict_entry[0]->path, "conflicts-two.txt") == 0);
cl_assert(git_index_conflict_next(&conflict_entry[0], &conflict_entry[1], &conflict_entry[2], iterator) == GIT_ITEROVER);
......@@ -281,7 +281,7 @@ void test_index_conflicts__partial(void)
cl_git_pass(git_index_conflict_get(&conflict_entry[0], &conflict_entry[1],
&conflict_entry[2], repo_index, "test-one.txt"));
cl_assert(git_oid_cmp(&ancestor_entry.id, &conflict_entry[0]->id) == 0);
cl_assert_equal_oid(&ancestor_entry.id, &conflict_entry[0]->id);
cl_assert(conflict_entry[1] == NULL);
cl_assert(conflict_entry[2] == NULL);
}
......@@ -41,7 +41,7 @@ void test_index_crlf__autocrlf_false_no_attrs(void)
cl_git_pass(git_oid_fromstr(&oid,
(GIT_EOL_NATIVE == GIT_EOL_CRLF) ? FILE_OID_CRLF : FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__autocrlf_true_no_attrs(void)
......@@ -58,7 +58,7 @@ void test_index_crlf__autocrlf_true_no_attrs(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__autocrlf_input_no_attrs(void)
......@@ -75,7 +75,7 @@ void test_index_crlf__autocrlf_input_no_attrs(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__autocrlf_false_text_auto_attr(void)
......@@ -94,7 +94,7 @@ void test_index_crlf__autocrlf_false_text_auto_attr(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__autocrlf_true_text_auto_attr(void)
......@@ -113,7 +113,7 @@ void test_index_crlf__autocrlf_true_text_auto_attr(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__autocrlf_input_text_auto_attr(void)
......@@ -132,7 +132,7 @@ void test_index_crlf__autocrlf_input_text_auto_attr(void)
entry = git_index_get_bypath(g_index, "newfile.txt", 0);
cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
cl_assert(git_oid_cmp(&oid, &entry->id) == 0);
cl_assert_equal_oid(&oid, &entry->id);
}
void test_index_crlf__safecrlf_true_no_attrs(void)
......
......@@ -37,7 +37,7 @@ void test_index_read_tree__read_write_involution(void)
git_tree_free(tree);
cl_git_pass(git_index_write_tree(&tree_oid, index));
cl_assert(git_oid_cmp(&expected, &tree_oid) == 0);
cl_assert_equal_oid(&expected, &tree_oid);
git_index_free(index);
git_repository_free(repo);
......
......@@ -27,7 +27,7 @@ void test_index_rename__single_file(void)
cl_assert(!git_index_find(&position, index, "lame.name.txt"));
entry = git_index_get_byindex(index, position);
cl_assert(git_oid_cmp(&expected, &entry->id) == 0);
cl_assert_equal_oid(&expected, &entry->id);
/* This removes the entry from the index, but not from the object database */
cl_git_pass(git_index_remove(index, "lame.name.txt", 0));
......@@ -41,7 +41,7 @@ void test_index_rename__single_file(void)
cl_assert(!git_index_find(&position, index, "fancy.name.txt"));
entry = git_index_get_byindex(index, position);
cl_assert(git_oid_cmp(&expected, &entry->id) == 0);
cl_assert_equal_oid(&expected, &entry->id);
git_index_free(index);
git_repository_free(repo);
......
......@@ -53,9 +53,9 @@ void test_index_reuc__add(void)
cl_assert(reuc->mode[0] == 0100644);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
cl_assert(git_oid_cmp(&reuc->oid[0], &ancestor_oid) == 0);
cl_assert(git_oid_cmp(&reuc->oid[1], &our_oid) == 0);
cl_assert(git_oid_cmp(&reuc->oid[2], &their_oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &ancestor_oid);
cl_assert_equal_oid(&reuc->oid[1], &our_oid);
cl_assert_equal_oid(&reuc->oid[2], &their_oid);
}
void test_index_reuc__add_no_ancestor(void)
......@@ -78,9 +78,9 @@ void test_index_reuc__add_no_ancestor(void)
cl_assert(reuc->mode[0] == 0);
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
cl_assert(git_oid_cmp(&reuc->oid[0], &ancestor_oid) == 0);
cl_assert(git_oid_cmp(&reuc->oid[1], &our_oid) == 0);
cl_assert(git_oid_cmp(&reuc->oid[2], &their_oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &ancestor_oid);
cl_assert_equal_oid(&reuc->oid[1], &our_oid);
cl_assert_equal_oid(&reuc->oid[2], &their_oid);
}
void test_index_reuc__read_bypath(void)
......@@ -97,11 +97,11 @@ void test_index_reuc__read_bypath(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, TWO_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, TWO_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
cl_assert(reuc = git_index_reuc_get_bypath(repo_index, "one.txt"));
......@@ -110,11 +110,11 @@ void test_index_reuc__read_bypath(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, ONE_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, ONE_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, ONE_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
void test_index_reuc__ignore_case(void)
......@@ -142,11 +142,11 @@ void test_index_reuc__ignore_case(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, TWO_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, TWO_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
void test_index_reuc__read_byindex(void)
......@@ -163,11 +163,11 @@ void test_index_reuc__read_byindex(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, ONE_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, ONE_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, ONE_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
cl_assert(reuc = git_index_reuc_get_byindex(repo_index, 1));
......@@ -176,11 +176,11 @@ void test_index_reuc__read_byindex(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, TWO_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, TWO_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
void test_index_reuc__updates_existing(void)
......@@ -216,11 +216,11 @@ void test_index_reuc__updates_existing(void)
cl_assert_equal_s("TWO.txt", reuc->path);
git_oid_fromstr(&oid, TWO_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, TWO_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
void test_index_reuc__remove(void)
......@@ -242,11 +242,11 @@ void test_index_reuc__remove(void)
cl_assert(reuc->mode[1] == 0100644);
cl_assert(reuc->mode[2] == 0100644);
git_oid_fromstr(&oid, TWO_ANCESTOR_OID);
cl_assert(git_oid_cmp(&reuc->oid[0], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[0], &oid);
git_oid_fromstr(&oid, TWO_OUR_OID);
cl_assert(git_oid_cmp(&reuc->oid[1], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[1], &oid);
git_oid_fromstr(&oid, TWO_THEIR_OID);
cl_assert(git_oid_cmp(&reuc->oid[2], &oid) == 0);
cl_assert_equal_oid(&reuc->oid[2], &oid);
}
void test_index_reuc__write(void)
......
......@@ -243,11 +243,11 @@ void test_index_tests__add(void)
entry = git_index_get_byindex(index, 0);
/* And the built-in hashing mechanism worked as expected */
cl_assert(git_oid_cmp(&id1, &entry->id) == 0);
cl_assert_equal_oid(&id1, &entry->id);
/* Test access by path instead of index */
cl_assert((entry = git_index_get_bypath(index, "test.txt", 0)) != NULL);
cl_assert(git_oid_cmp(&id1, &entry->id) == 0);
cl_assert_equal_oid(&id1, &entry->id);
git_index_free(index);
git_repository_free(repo);
......@@ -283,14 +283,14 @@ void test_index_tests__add_issue_1397(void)
/* Make sure the initial SHA-1 is correct */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
cl_assert_(git_oid_cmp(&id1, &entry->id) == 0, "first oid check");
cl_assert_equal_oid(&id1, &entry->id);
/* Update the index */
cl_git_pass(git_index_add_bypath(index, "crlf_file.txt"));
/* Check the new SHA-1 */
cl_assert((entry = git_index_get_bypath(index, "crlf_file.txt", 0)) != NULL);
cl_assert_(git_oid_cmp(&id1, &entry->id) == 0, "second oid check");
cl_assert_equal_oid(&id1, &entry->id);
git_index_free(index);
}
......
......@@ -259,7 +259,7 @@ void test_merge_trees_trivial__13(void)
cl_assert(entry = git_index_get_bypath(result, "modified-in-13.txt", 0));
cl_git_pass(git_oid_fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b"));
cl_assert(git_oid_cmp(&entry->id, &expected_oid) == 0);
cl_assert_equal_oid(&expected_oid, &entry->id);
cl_assert(git_index_reuc_entrycount(result) == 0);
cl_assert(merge_trivial_conflict_entrycount(result) == 0);
......
......@@ -21,7 +21,7 @@ static void assert_note_equal(git_note *note, char *message, git_oid *note_oid)
git_blob *blob;
cl_assert_equal_s(git_note_message(note), message);
cl_assert(!git_oid_cmp(git_note_id(note), note_oid));
cl_assert_equal_oid(git_note_id(note), note_oid);
cl_git_pass(git_blob_lookup(&blob, _repo, note_oid));
cl_assert_equal_s(git_note_message(note), (const char *)git_blob_rawcontent(blob));
......@@ -61,10 +61,10 @@ static int note_list_cb(
cl_assert(*count < EXPECTATIONS_COUNT);
cl_git_pass(git_oid_fromstr(&expected_note_oid, list_expectations[*count].note_sha));
cl_assert(git_oid_cmp(&expected_note_oid, blob_id) == 0);
cl_assert_equal_oid(&expected_note_oid, blob_id);
cl_git_pass(git_oid_fromstr(&expected_target_oid, list_expectations[*count].annotated_object_sha));
cl_assert(git_oid_cmp(&expected_target_oid, annotated_obj_id) == 0);
cl_assert_equal_oid(&expected_target_oid, annotated_obj_id);
(*count)++;
......@@ -290,7 +290,7 @@ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void)
cl_git_pass(git_note_read(&note, _repo, "refs/notes/fanout", &target_oid));
cl_git_pass(git_oid_fromstr(&note_oid, "08b041783f40edfe12bb406c9c9a8a040177c125"));
cl_assert(!git_oid_cmp(git_note_id(note), &note_oid));
cl_assert_equal_oid(git_note_id(note), &note_oid);
git_note_free(note);
}
......
......@@ -46,13 +46,13 @@ void test_notes_notesref__config_corenotesref(void)
cl_git_pass(git_note_read(&_note, _repo, NULL, &oid));
cl_assert_equal_s("test123test\n", git_note_message(_note));
cl_assert(!git_oid_cmp(git_note_id(_note), &note_oid));
cl_assert_equal_oid(git_note_id(_note), &note_oid);
git_note_free(_note);
cl_git_pass(git_note_read(&_note, _repo, "refs/notes/mydefaultnotesref", &oid));
cl_assert_equal_s("test123test\n", git_note_message(_note));
cl_assert(!git_oid_cmp(git_note_id(_note), &note_oid));
cl_assert_equal_oid(git_note_id(_note), &note_oid);
cl_git_pass(git_note_default_ref(&default_ref, _repo));
cl_assert_equal_s("refs/notes/mydefaultnotesref", default_ref);
......
......@@ -52,16 +52,16 @@ void test_object_lookupbypath__from_root_tree(void)
{
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_root_tree,
"subdir/subdir_test2.txt", GIT_OBJ_BLOB));
cl_assert_equal_i(0, git_oid_cmp(git_object_id(g_expectedobject),
git_object_id(g_actualobject)));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
}
void test_object_lookupbypath__from_head_commit(void)
{
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)g_head_commit,
"subdir/subdir_test2.txt", GIT_OBJ_BLOB));
cl_assert_equal_i(0, git_oid_cmp(git_object_id(g_expectedobject),
git_object_id(g_actualobject)));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
}
void test_object_lookupbypath__from_subdir_tree(void)
......@@ -74,8 +74,8 @@ void test_object_lookupbypath__from_subdir_tree(void)
cl_git_pass(git_object_lookup_bypath(&g_actualobject, (git_object*)tree,
"subdir_test2.txt", GIT_OBJ_BLOB));
cl_assert_equal_i(0, git_oid_cmp(git_object_id(g_expectedobject),
git_object_id(g_actualobject)));
cl_assert_equal_oid(git_object_id(g_expectedobject),
git_object_id(g_actualobject));
git_tree_entry_free(entry);
git_tree_free(tree);
......
......@@ -29,7 +29,7 @@ static void assert_peel(
cl_git_pass(git_object_peel(&peeled, obj, requested_type));
cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha));
cl_assert_equal_i(0, git_oid_cmp(&expected_oid, git_object_id(peeled)));
cl_assert_equal_oid(&expected_oid, git_object_id(peeled));
cl_assert_equal_i(expected_type, git_object_type(peeled));
......
......@@ -58,7 +58,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert(git_oid_equal(&found, git_odb_object_id(obj)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "dea509d0b", sizeof(hex));
......@@ -79,7 +79,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert(git_oid_equal(&found, git_odb_object_id(obj)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "81b5bff5f", sizeof(hex));
......@@ -100,7 +100,7 @@ void test_odb_mixed__dup_oid_prefix_0(void) {
cl_git_pass(git_oid_fromstrn(&oid, hex, strlen(hex)));
cl_git_pass(git_odb_read_prefix(&obj, _odb, &oid, strlen(hex)));
cl_git_pass(git_odb_exists_prefix(&found, _odb, &oid, strlen(hex)));
cl_assert(git_oid_equal(&found, git_odb_object_id(obj)));
cl_assert_equal_oid(&found, git_odb_object_id(obj));
git_odb_object_free(obj);
strncpy(hex, "0ddeadede", sizeof(hex));
......
......@@ -74,7 +74,7 @@ void test_pack_indexer__fix_thin(void)
/* Store the missing base into your ODB so the indexer can fix the pack */
cl_git_pass(git_odb_write(&id, odb, base_obj, base_obj_len, GIT_OBJ_BLOB));
git_oid_fromstr(&should_id, "e68fe8129b546b101aee9510c5328e7f21ca1d18");
cl_assert(!git_oid_cmp(&id, &should_id));
cl_assert_equal_oid(&should_id, &id);
cl_git_pass(git_indexer_new(&idx, ".", 0, odb, NULL, NULL));
cl_git_pass(git_indexer_append(idx, thin_pack, thin_pack_len, &stats));
......@@ -86,7 +86,7 @@ void test_pack_indexer__fix_thin(void)
cl_assert_equal_i(stats.local_objects, 1);
git_oid_fromstr(&should_id, "11f0f69b334728fdd8bc86b80499f22f29d85b15");
cl_assert(!git_oid_cmp(git_indexer_hash(idx), &should_id));
cl_assert_equal_oid(&should_id, git_indexer_hash(idx));
git_indexer_free(idx);
git_odb_free(odb);
......
......@@ -45,7 +45,7 @@ void test_refs_create__symbolic(void)
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
/* ...and that it points to the current master tip */
cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(resolved_ref));
git_reference_free(looked_up_ref);
git_reference_free(resolved_ref);
......@@ -54,7 +54,7 @@ void test_refs_create__symbolic(void)
cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head_tracker));
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(resolved_ref));
git_repository_free(repo2);
......@@ -76,7 +76,7 @@ void test_refs_create__deep_symbolic(void)
cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0, NULL, NULL));
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker));
cl_git_pass(git_reference_resolve(&resolved_ref, looked_up_ref));
cl_assert(git_oid_cmp(&id, git_reference_target(resolved_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(resolved_ref));
git_reference_free(new_reference);
git_reference_free(looked_up_ref);
......@@ -104,14 +104,14 @@ void test_refs_create__oid(void)
cl_assert_equal_s(looked_up_ref->name, new_head);
/* ...and that it points to the current master tip */
cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(looked_up_ref));
git_reference_free(looked_up_ref);
/* Similar test with a fresh new repository */
cl_git_pass(git_repository_open(&repo2, "testrepo"));
cl_git_pass(git_reference_lookup(&looked_up_ref, repo2, new_head));
cl_assert(git_oid_cmp(&id, git_reference_target(looked_up_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(looked_up_ref));
git_repository_free(repo2);
......
......@@ -42,7 +42,7 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0);
cl_assert(git_oid_cmp(&id, &entry->oid_cur) == 0);
cl_assert_equal_oid(&id, &entry->oid_cur);
cl_assert_equal_s(message, entry->msg);
git_reflog_free(reflog);
......
......@@ -44,7 +44,7 @@ void test_refs_lookup__oid(void)
cl_git_pass(git_reference_name_to_id(&tag, g_repo, "refs/tags/point_to_blob"));
cl_git_pass(git_oid_fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
cl_assert(git_oid_cmp(&tag, &expected) == 0);
cl_assert_equal_oid(&expected, &tag);
}
void test_refs_lookup__namespace(void)
......
......@@ -78,7 +78,7 @@ void test_refs_overwrite__object_id(void)
/* Ensure it has been overwritten */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(!git_oid_cmp(&id, git_reference_target(ref)));
cl_assert_equal_oid(&id, git_reference_target(ref));
git_reference_free(ref);
}
......@@ -130,7 +130,7 @@ void test_refs_overwrite__symbolic_with_object_id(void)
/* Ensure it points to the right place */
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_name));
cl_assert(git_reference_type(ref) & GIT_REF_OID);
cl_assert(!git_oid_cmp(git_reference_target(ref), &id));
cl_assert_equal_oid(&id, git_reference_target(ref));
git_reference_free(ref);
}
......@@ -33,7 +33,7 @@ static void assert_peel_generic(
cl_git_pass(git_reference_peel(&peeled, ref, requested_type));
cl_git_pass(git_oid_fromstr(&expected_oid, expected_sha));
cl_assert_equal_i(0, git_oid_cmp(&expected_oid, git_object_id(peeled)));
cl_assert_equal_oid(&expected_oid, git_object_id(peeled));
cl_assert_equal_i(expected_type, git_object_type(peeled));
......
......@@ -83,7 +83,7 @@ void test_refs_read__symbolic(void)
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
git_oid_fromstr(&id, current_master_tip);
cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
cl_assert_equal_oid(&id, git_object_id(object));
git_object_free(object);
......@@ -111,7 +111,7 @@ void test_refs_read__nested_symbolic(void)
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
git_oid_fromstr(&id, current_master_tip);
cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
cl_assert_equal_oid(&id, git_object_id(object));
git_object_free(object);
......@@ -130,13 +130,13 @@ void test_refs_read__head_then_master(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref)));
cl_assert_equal_oid(git_reference_target(comp_base_ref), git_reference_target(resolved_ref));
git_reference_free(reference);
git_reference_free(resolved_ref);
cl_git_pass(git_reference_lookup(&reference, g_repo, current_head_target));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_git_pass(git_oid_cmp(git_reference_target(comp_base_ref), git_reference_target(resolved_ref)));
cl_assert_equal_oid(git_reference_target(comp_base_ref), git_reference_target(resolved_ref));
git_reference_free(reference);
git_reference_free(resolved_ref);
......@@ -152,7 +152,7 @@ void test_refs_read__master_then_head(void)
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
cl_git_pass(git_oid_cmp(git_reference_target(master_ref), git_reference_target(resolved_ref)));
cl_assert_equal_oid(git_reference_target(master_ref), git_reference_target(resolved_ref));
git_reference_free(reference);
git_reference_free(resolved_ref);
......@@ -201,7 +201,7 @@ void test_refs_read__chomped(void)
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
cl_git_pass(git_reference_lookup(&chomped, g_repo, "refs/heads/chomped"));
cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(chomped)));
cl_assert_equal_oid(git_reference_target(test), git_reference_target(chomped));
git_reference_free(test);
git_reference_free(chomped);
......@@ -213,7 +213,7 @@ void test_refs_read__trailing(void)
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing"));
cl_git_pass(git_oid_cmp(git_reference_target(test), git_reference_target(trailing)));
cl_assert_equal_oid(git_reference_target(test), git_reference_target(trailing));
git_reference_free(trailing);
cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD"));
......
......@@ -220,7 +220,7 @@ void test_refs_rename__force_loose_packed(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref)));
cl_assert_equal_oid(&oid, git_reference_target(looked_up_ref));
git_reference_free(looked_up_ref);
/* And that the previous one doesn't exist any longer */
......@@ -245,7 +245,7 @@ void test_refs_rename__force_loose(void)
/* Check we actually renamed it */
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
cl_assert_equal_s(looked_up_ref->name, "refs/heads/test");
cl_assert(!git_oid_cmp(&oid, git_reference_target(looked_up_ref)));
cl_assert_equal_oid(&oid, git_reference_target(looked_up_ref));
git_reference_free(looked_up_ref);
/* And that the previous one doesn't exist any longer */
......
......@@ -44,8 +44,8 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
cl_git_pass(git_reflog_read(&reflog, g_repo, br2_name));
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert(git_oid_cmp(&current_id, &entry->oid_old) == 0);
cl_assert(git_oid_cmp(&target_id, &entry->oid_cur) == 0);
cl_assert_equal_oid(&current_id, &entry->oid_old);
cl_assert_equal_oid(&target_id, &entry->oid_cur);
cl_assert_equal_s(message, entry->msg);
git_reflog_free(reflog);
......
......@@ -41,7 +41,7 @@ void test_refs_setter__update_direct(void)
cl_git_pass(git_reference_lookup(&test_ref, g_repo, ref_test_name));
cl_assert(git_reference_type(test_ref) == GIT_REF_OID);
cl_assert(git_oid_cmp(&id, git_reference_target(test_ref)) == 0);
cl_assert_equal_oid(&id, git_reference_target(test_ref));
git_reference_free(test_ref);
}
......
......@@ -32,8 +32,7 @@ void test_refs_unicode__create_and_lookup(void)
cl_git_pass(git_repository_open(&repo2, "testrepo.git"));
cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME));
cl_assert_equal_i(
0, git_oid_cmp(git_reference_target(ref1), git_reference_target(ref2)));
cl_assert_equal_oid(git_reference_target(ref1), git_reference_target(ref2));
cl_assert_equal_s(REFNAME, git_reference_name(ref2));
git_reference_free(ref2);
......@@ -43,8 +42,7 @@ void test_refs_unicode__create_and_lookup(void)
#define REFNAME_DECOMPOSED "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m"
cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME_DECOMPOSED));
cl_assert_equal_i(
0, git_oid_cmp(git_reference_target(ref1), git_reference_target(ref2)));
cl_assert_equal_oid(git_reference_target(ref1), git_reference_target(ref2));
cl_assert_equal_s(REFNAME, git_reference_name(ref2));
git_reference_free(ref2);
#endif
......
......@@ -22,14 +22,14 @@ void test_repo_hashfile__simple(void)
/* hash with repo relative path */
cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJ_BLOB, NULL));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
cl_git_pass(git_buf_joinpath(&full, git_repository_workdir(_repo), "current_file"));
/* hash with full path */
cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_BLOB, NULL));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
/* hash with invalid type */
cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJ_ANY));
......@@ -58,12 +58,12 @@ void test_repo_hashfile__filtered(void)
/* equal hashes because filter is binary */
cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, NULL));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
/* equal hashes when 'as_file' points to binary filtering */
cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "foo.bin"));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
/* not equal hashes when 'as_file' points to text filtering */
cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB));
......@@ -73,11 +73,11 @@ void test_repo_hashfile__filtered(void)
/* equal hashes when 'as_file' is empty and turns off filtering */
cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, ""));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB));
cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, ""));
cl_assert(git_oid_equal(&a, &b));
cl_assert_equal_oid(&a, &b);
/* some hash type failures */
cl_git_fail(git_odb_hashfile(&a, "status/testfile.txt", 0));
......
......@@ -229,13 +229,13 @@ static void test_reflog(git_repository *repo, size_t idx,
if (old_spec) {
git_object *obj;
cl_git_pass(git_revparse_single(&obj, repo, old_spec));
cl_assert_equal_i(0, git_oid_cmp(git_object_id(obj), git_reflog_entry_id_old(entry)));
cl_assert_equal_oid(git_object_id(obj), git_reflog_entry_id_old(entry));
git_object_free(obj);
}
if (new_spec) {
git_object *obj;
cl_git_pass(git_revparse_single(&obj, repo, new_spec));
cl_assert_equal_i(0, git_oid_cmp(git_object_id(obj), git_reflog_entry_id_new(entry)));
cl_assert_equal_oid(git_object_id(obj), git_reflog_entry_id_new(entry));
git_object_free(obj);
}
......
......@@ -69,21 +69,15 @@ static int hide_commit_cb(const git_oid *commit_id, void *data)
GIT_UNUSED(commit_id);
GIT_UNUSED(data);
if (0 == git_oid_cmp(commit_id, &commit_ids[5]))
return 1;
else
return 0;
return (git_oid_cmp(commit_id, &commit_ids[5]) == 0);
}
/* In payload data, pointer to a commit id is passed */
static int hide_commit_use_payload_cb(const git_oid *commit_id, void *data)
{
git_oid *hide_commit_id = data;
if (git_oid_cmp(commit_id, hide_commit_id) == 0)
return 1;
else
return 0;
return (git_oid_cmp(commit_id, hide_commit_id) == 0);
}
void test_revwalk_hidecb__hide_all_cb(void)
......@@ -170,7 +164,7 @@ void test_revwalk_hidecb__hide_some_commits(void)
i = 0;
while ((error = git_revwalk_next(&id, walk)) == 0) {
cl_assert_equal_i(git_oid_cmp(&id, &commit_ids[i]), 0);
cl_assert_equal_oid(&commit_ids[i], &id);
i++;
}
......@@ -194,7 +188,7 @@ void test_revwalk_hidecb__test_payload(void)
i = 0;
while ((error = git_revwalk_next(&id, walk)) == 0) {
cl_assert_equal_i(git_oid_cmp(&id, &commit_ids[i]), 0);
cl_assert_equal_oid(&commit_ids[i], &id);
i++;
}
......
......@@ -30,7 +30,7 @@ void test_revwalk_mergebase__single1(void)
cl_git_pass(git_oid_fromstr(&expected, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 2);
......@@ -51,7 +51,7 @@ void test_revwalk_mergebase__single2(void)
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 4);
......@@ -72,10 +72,10 @@ void test_revwalk_mergebase__merged_branch(void)
cl_git_pass(git_oid_fromstr(&expected, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_merge_base(&result, _repo, &two, &one));
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_assert_equal_oid(&expected, &result);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_sz(ahead, 0);
......@@ -132,7 +132,7 @@ void test_revwalk_mergebase__prefer_youngest_merge_base(void)
cl_git_pass(git_oid_fromstr(&expected, "c47800c7266a2be04c571c04d5a6614691ea99bd"));
cl_git_pass(git_merge_base(&result, _repo, &one, &two));
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_assert_equal_oid(&expected, &result);
}
void test_revwalk_mergebase__no_off_by_one_missing(void)
......@@ -177,7 +177,7 @@ static void assert_mergebase_many(const char *expected_sha, int count, ...)
cl_git_pass(git_merge_base_many(&oid, _repo, count, oids));
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
cl_assert(git_oid_cmp(&expected, &oid) == 0);
cl_assert_equal_oid(&expected, &oid);
}
git__free(oids);
......@@ -241,7 +241,7 @@ static void assert_mergebase_octopus(const char *expected_sha, int count, ...)
cl_git_pass(git_merge_base_octopus(&oid, _repo, count, oids));
cl_git_pass(git_oid_fromstr(&expected, expected_sha));
cl_assert(git_oid_cmp(&expected, &oid) == 0);
cl_assert_equal_oid(&expected, &oid);
}
git__free(oids);
......
......@@ -20,8 +20,8 @@ static const char *commit_head = "a4a7dce85cf63874e984719f4fdd239f5145052f";
static const char *expected_str[] = {
"a4a7dce85cf63874e984719f4fdd239f5145052f", /* 0 */
"c47800c7266a2be04c571c04d5a6614691ea99bd", /* 3 */
"8496071c1b46c854b31185ea97743be6a8774479", /* 4 */
"5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 5 */
"5b5b025afb0b4c913b4c338a42934a3863bf3644", /* 4 */
"8496071c1b46c854b31185ea97743be6a8774479", /* 5 */
};
void test_revwalk_simplify__first_parent(void)
......@@ -44,7 +44,7 @@ void test_revwalk_simplify__first_parent(void)
i = 0;
while ((error = git_revwalk_next(&id, walk)) == 0) {
git_oid_cmp(&id, &expected[i]);
cl_assert_equal_oid(&expected[i], &id);
i++;
}
......
......@@ -115,7 +115,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
cl_git_pass(git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE));
entry = git_reflog_entry_byindex(reflog, 0);
cl_assert_equal_i(0, git_oid_cmp(&oid, git_reflog_entry_id_old(entry)));
cl_assert_equal_oid(&oid, git_reflog_entry_id_old(entry));
cl_assert_equal_sz(count - 1, git_reflog_entrycount(reflog));
git_reflog_free(reflog);
......@@ -147,7 +147,7 @@ void retrieve_top_stash_id(git_oid *out)
cl_git_pass(git_revparse_single(&top_stash, repo, "stash@{0}"));
cl_git_pass(git_reference_name_to_id(out, repo, GIT_REFS_STASH_FILE));
cl_assert_equal_i(true, git_oid_cmp(out, git_object_id(top_stash)) == 0);
cl_assert_equal_oid(out, git_object_id(top_stash));
git_object_free(top_stash);
}
......@@ -162,13 +162,13 @@ void test_stash_drop__dropping_the_top_stash_updates_the_stash_reference(void)
retrieve_top_stash_id(&oid);
cl_git_pass(git_revparse_single(&next_top_stash, repo, "stash@{1}"));
cl_assert(git_oid_cmp(&oid, git_object_id(next_top_stash)) != 0);
cl_assert(git_oid_cmp(&oid, git_object_id(next_top_stash)));
cl_git_pass(git_stash_drop(repo, 0));
retrieve_top_stash_id(&oid);
cl_git_pass(git_oid_cmp(&oid, git_object_id(next_top_stash)));
cl_assert_equal_oid(&oid, git_object_id(next_top_stash));
git_object_free(next_top_stash);
}
......@@ -22,7 +22,7 @@ void test_status_single__hash_single_file(void)
cl_set_cleanup(&cleanup__remove_file, (void *)file_name);
cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB));
cl_assert(git_oid_cmp(&expected_id, &actual_id) == 0);
cl_assert_equal_oid(&expected_id, &actual_id);
}
/* test retrieving OID from an empty file apart from the ODB */
......@@ -40,6 +40,6 @@ void test_status_single__hash_single_empty_file(void)
cl_set_cleanup(&cleanup__remove_file, (void *)file_name);
cl_git_pass(git_odb_hashfile(&actual_id, file_name, GIT_OBJ_BLOB));
cl_assert(git_oid_cmp(&expected_id, &actual_id) == 0);
cl_assert_equal_oid(&expected_id, &actual_id);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment