diff options
Diffstat (limited to 'tests/libgit2/refs/reflog')
-rw-r--r-- | tests/libgit2/refs/reflog/drop.c | 4 | ||||
-rw-r--r-- | tests/libgit2/refs/reflog/messages.c | 12 | ||||
-rw-r--r-- | tests/libgit2/refs/reflog/reflog.c | 24 | ||||
-rw-r--r-- | tests/libgit2/refs/reflog/reflog_helpers.c | 26 |
4 files changed, 33 insertions, 33 deletions
diff --git a/tests/libgit2/refs/reflog/drop.c b/tests/libgit2/refs/reflog/drop.c index 916bd9933..2d7193380 100644 --- a/tests/libgit2/refs/reflog/drop.c +++ b/tests/libgit2/refs/reflog/drop.c @@ -70,7 +70,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry(void) cl_assert_equal_sz(entrycount - 1, git_reflog_entrycount(g_reflog)); entry = git_reflog_entry_byindex(g_reflog, entrycount - 2); - cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) != 0); + cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) != 0); } void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_history(void) @@ -83,7 +83,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_histor cl_assert_equal_sz(entrycount - 1, git_reflog_entrycount(g_reflog)); entry = git_reflog_entry_byindex(g_reflog, entrycount - 2); - cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0); + cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0); } void test_refs_reflog_drop__can_drop_all_the_entries(void) diff --git a/tests/libgit2/refs/reflog/messages.c b/tests/libgit2/refs/reflog/messages.c index ed183d2f2..647c00d0d 100644 --- a/tests/libgit2/refs/reflog/messages.c +++ b/tests/libgit2/refs/reflog/messages.c @@ -87,7 +87,7 @@ void test_refs_reflog_messages__detaching_writes_reflog(void) const char *msg; msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d"; - git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d"); + git_oid__fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1); cl_git_pass(git_repository_set_head_detached(g_repo, &id)); cl_reflog_check_entry(g_repo, GIT_HEAD_FILE, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", @@ -109,7 +109,7 @@ void test_refs_reflog_messages__orphan_branch_does_not_count(void) /* Have something known */ msg = "checkout: moving from master to e90810b8df3e80c413d903f631643c716887138d"; - git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d"); + git_oid__fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d", GIT_OID_SHA1); cl_git_pass(git_repository_set_head_detached(g_repo, &id)); cl_reflog_check_entry(g_repo, GIT_HEAD_FILE, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", @@ -264,7 +264,7 @@ void test_refs_reflog_messages__creating_a_direct_reference(void) cl_assert_equal_sz(1, git_reflog_entrycount(reflog)); entry = git_reflog_entry_byindex(reflog, 0); - cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0); + cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0); cl_assert_equal_oid(&id, &entry->oid_cur); cl_assert_equal_s(message, entry->msg); @@ -280,7 +280,7 @@ void test_refs_reflog_messages__newline_gets_replaced(void) git_oid oid; cl_git_pass(git_signature_now(&signature, "me", "foo@example.com")); - cl_git_pass(git_oid_fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750")); + cl_git_pass(git_oid__fromstr(&oid, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1)); cl_git_pass(git_reflog_read(&reflog, g_repo, "HEAD")); cl_assert_equal_sz(7, git_reflog_entrycount(reflog)); @@ -352,7 +352,7 @@ void test_refs_reflog_messages__creating_branches_default_messages(void) cl_git_pass(git_str_printf(&buf, "branch: Created from %s", git_oid_tostr_s(git_commit_id(target)))); cl_reflog_check_entry(g_repo, "refs/heads/" NEW_BRANCH_NAME, 0, - GIT_OID_HEX_ZERO, + GIT_OID_SHA1_HEXZERO, git_oid_tostr_s(git_commit_id(target)), g_email, git_str_cstr(&buf)); @@ -362,7 +362,7 @@ void test_refs_reflog_messages__creating_branches_default_messages(void) cl_git_pass(git_branch_create_from_annotated(&branch2, g_repo, NEW_BRANCH_NAME, annotated, true)); cl_reflog_check_entry(g_repo, "refs/heads/" NEW_BRANCH_NAME, 0, - GIT_OID_HEX_ZERO, + GIT_OID_SHA1_HEXZERO, git_oid_tostr_s(git_commit_id(target)), g_email, "branch: Created from e90810b8df3"); diff --git a/tests/libgit2/refs/reflog/reflog.c b/tests/libgit2/refs/reflog/reflog.c index 32ce7ffb7..774ec6c93 100644 --- a/tests/libgit2/refs/reflog/reflog.c +++ b/tests/libgit2/refs/reflog/reflog.c @@ -52,7 +52,7 @@ static void assert_appends(const git_signature *committer, const git_oid *oid) /* The first one was the creation of the branch */ entry = git_reflog_entry_byindex(reflog, 2); - cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0); + cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_SHA1_HEXZERO) == 0); entry = git_reflog_entry_byindex(reflog, 1); assert_signature(committer, entry->committer); @@ -80,7 +80,7 @@ void test_refs_reflog_reflog__append_then_read(void) git_reflog *reflog; /* Create a new branch pointing at the HEAD */ - git_oid_fromstr(&oid, current_master_tip); + git_oid__fromstr(&oid, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &oid, 0, NULL)); git_reference_free(ref); @@ -147,7 +147,7 @@ void test_refs_reflog_reflog__removes_empty_reflog_dir(void) git_oid id; /* Create a new branch pointing at the HEAD */ - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir/new-head", &id, 0, NULL)); git_str_joinpath(&log_path, git_repository_path(g_repo), GIT_REFLOG_DIR); @@ -159,7 +159,7 @@ void test_refs_reflog_reflog__removes_empty_reflog_dir(void) git_reference_free(ref); /* new ref creation should succeed since new-dir is empty */ - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir", &id, 0, NULL)); git_reference_free(ref); @@ -173,7 +173,7 @@ void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void) git_oid id; /* Create a new branch pointing at the HEAD */ - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/new-dir/new-head", &id, 0, NULL)); git_reference_free(ref); @@ -186,7 +186,7 @@ void test_refs_reflog_reflog__fails_gracefully_on_nonempty_reflog_dir(void) cl_must_pass(p_unlink("testrepo.git/refs/heads/new-dir/new-head")); /* new ref creation should fail since new-dir contains reflogs still */ - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_fail_with(GIT_EDIRECTORY, git_reference_create(&ref, g_repo, "refs/heads/new-dir", &id, 0, NULL)); git_reference_free(ref); @@ -235,7 +235,7 @@ void test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_succeeds(void char *star; /* Create a new branch. */ - cl_git_pass(git_oid_fromstr(&id, current_master_tip)); + cl_git_pass(git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1)); cl_git_pass(git_reference_create(&ref, g_repo, refname, &id, 1, refmessage)); /* @@ -298,7 +298,7 @@ void test_refs_reflog_reflog__write_only_std_locations(void) git_reference *ref; git_oid id; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/foo", &id, 1, NULL)); git_reference_free(ref); @@ -318,7 +318,7 @@ void test_refs_reflog_reflog__write_when_explicitly_active(void) git_reference *ref; git_oid id; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); git_reference_ensure_log(g_repo, "refs/tags/foo"); cl_git_pass(git_reference_create(&ref, g_repo, "refs/tags/foo", &id, 1, NULL)); @@ -338,7 +338,7 @@ void test_refs_reflog_reflog__append_to_HEAD_when_changing_current_branch(void) git_reflog_free(log); /* Move it back */ - git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); + git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/master", &id, 1, NULL)); git_reference_free(ref); @@ -390,7 +390,7 @@ static void assert_no_reflog_update(void) git_reflog_free(log); /* Move it back */ - git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); + git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/heads/master", &id, 1, NULL)); git_reference_free(ref); @@ -431,7 +431,7 @@ void test_refs_reflog_reflog__logallrefupdates_bare_set_always(void) cl_git_pass(git_config_set_string(config, "core.logallrefupdates", "always")); git_config_free(config); - git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); + git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(git_reference_create(&ref, g_repo, "refs/bork", &id, 1, "message")); cl_git_pass(git_reflog_read(&log, g_repo, "refs/bork")); diff --git a/tests/libgit2/refs/reflog/reflog_helpers.c b/tests/libgit2/refs/reflog/reflog_helpers.c index 2ea41ee06..6a7e706d6 100644 --- a/tests/libgit2/refs/reflog/reflog_helpers.c +++ b/tests/libgit2/refs/reflog/reflog_helpers.c @@ -6,12 +6,12 @@ int reflog_entry_tostr(git_str *out, const git_reflog_entry *entry) { - char old_oid[GIT_OID_HEXSZ], new_oid[GIT_OID_HEXSZ]; + char old_oid[GIT_OID_SHA1_HEXSIZE], new_oid[GIT_OID_SHA1_HEXSIZE]; assert(out && entry); - git_oid_tostr((char *)&old_oid, GIT_OID_HEXSZ, git_reflog_entry_id_old(entry)); - git_oid_tostr((char *)&new_oid, GIT_OID_HEXSZ, git_reflog_entry_id_new(entry)); + git_oid_tostr((char *)&old_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_old(entry)); + git_oid_tostr((char *)&new_oid, GIT_OID_SHA1_HEXSIZE, git_reflog_entry_id_new(entry)); return git_str_printf(out, "%s %s %s %s", old_oid, new_oid, "somesig", git_reflog_entry_message(entry)); } @@ -46,17 +46,17 @@ void cl_reflog_check_entry_(git_repository *repo, const char *reflog, size_t idx git_object *obj = NULL; if (git_revparse_single(&obj, repo, old_spec) == GIT_OK) { if (git_oid_cmp(git_object_id(obj), git_reflog_entry_id_old(entry)) != 0) { - git_oid__writebuf(&result, "\tOld OID: \"", git_object_id(obj)); - git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_old(entry)); + git_object__write_oid_header(&result, "\tOld OID: \"", git_object_id(obj)); + git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_old(entry)); git_str_puts(&result, "\"\n"); } git_object_free(obj); } else { git_oid *oid = git__calloc(1, sizeof(*oid)); - git_oid_fromstr(oid, old_spec); + git_oid__fromstr(oid, old_spec, GIT_OID_SHA1); if (git_oid_cmp(oid, git_reflog_entry_id_old(entry)) != 0) { - git_oid__writebuf(&result, "\tOld OID: \"", oid); - git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_old(entry)); + git_object__write_oid_header(&result, "\tOld OID: \"", oid); + git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_old(entry)); git_str_puts(&result, "\"\n"); } git__free(oid); @@ -66,17 +66,17 @@ void cl_reflog_check_entry_(git_repository *repo, const char *reflog, size_t idx git_object *obj = NULL; if (git_revparse_single(&obj, repo, new_spec) == GIT_OK) { if (git_oid_cmp(git_object_id(obj), git_reflog_entry_id_new(entry)) != 0) { - git_oid__writebuf(&result, "\tNew OID: \"", git_object_id(obj)); - git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_new(entry)); + git_object__write_oid_header(&result, "\tNew OID: \"", git_object_id(obj)); + git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_new(entry)); git_str_puts(&result, "\"\n"); } git_object_free(obj); } else { git_oid *oid = git__calloc(1, sizeof(*oid)); - git_oid_fromstr(oid, new_spec); + git_oid__fromstr(oid, new_spec, GIT_OID_SHA1); if (git_oid_cmp(oid, git_reflog_entry_id_new(entry)) != 0) { - git_oid__writebuf(&result, "\tNew OID: \"", oid); - git_oid__writebuf(&result, "\" != \"", git_reflog_entry_id_new(entry)); + git_object__write_oid_header(&result, "\tNew OID: \"", oid); + git_object__write_oid_header(&result, "\" != \"", git_reflog_entry_id_new(entry)); git_str_puts(&result, "\"\n"); } git__free(oid); |