diff options
Diffstat (limited to 'tests/libgit2/refs')
-rw-r--r-- | tests/libgit2/refs/basic.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/branches/delete.c | 8 | ||||
-rw-r--r-- | tests/libgit2/refs/branches/iterator.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/create.c | 22 | ||||
-rw-r--r-- | tests/libgit2/refs/delete.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/foreachglob.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/iterator.c | 3 | ||||
-rw-r--r-- | tests/libgit2/refs/lookup.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/peel.c | 2 | ||||
-rw-r--r-- | tests/libgit2/refs/races.c | 24 | ||||
-rw-r--r-- | tests/libgit2/refs/read.c | 4 | ||||
-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 | ||||
-rw-r--r-- | tests/libgit2/refs/revparse.c | 12 | ||||
-rw-r--r-- | tests/libgit2/refs/transactions.c | 10 |
17 files changed, 81 insertions, 80 deletions
diff --git a/tests/libgit2/refs/basic.c b/tests/libgit2/refs/basic.c index 32742f9cc..5e41ca074 100644 --- a/tests/libgit2/refs/basic.c +++ b/tests/libgit2/refs/basic.c @@ -53,7 +53,7 @@ void test_refs_basic__longpaths(void) git_reference *one = NULL, *two = NULL; git_oid id; - cl_git_pass(git_oid_fromstr(&id, "099fabac3a9ea935598528c27f866e34089c2eff")); + cl_git_pass(git_oid__fromstr(&id, "099fabac3a9ea935598528c27f866e34089c2eff", GIT_OID_SHA1)); base = git_repository_path(g_repo); base_len = git_utf8_char_length(base, strlen(base)); diff --git a/tests/libgit2/refs/branches/delete.c b/tests/libgit2/refs/branches/delete.c index 27995f9e2..6b3d507a8 100644 --- a/tests/libgit2/refs/branches/delete.c +++ b/tests/libgit2/refs/branches/delete.c @@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void) repo = cl_git_sandbox_init("testrepo.git"); - cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); + cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL)); } @@ -119,7 +119,7 @@ void test_refs_branches_delete__removes_reflog(void) { git_reference *branch; git_reflog *log; - git_oid oidzero = {{0}}; + git_oid oidzero = GIT_OID_SHA1_ZERO; git_signature *sig; /* Ensure the reflog has at least one entry */ @@ -150,14 +150,14 @@ void test_refs_branches_delete__removes_empty_folders(void) git_reference *branch; git_reflog *log; - git_oid oidzero = {{0}}; + git_oid oidzero = GIT_OID_SHA1_ZERO; git_signature *sig; git_str ref_folder = GIT_STR_INIT; git_str reflog_folder = GIT_STR_INIT; /* Create a new branch with a nested name */ - cl_git_pass(git_oid_fromstr(&commit_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750")); + cl_git_pass(git_oid__fromstr(&commit_id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1)); cl_git_pass(git_commit_lookup(&commit, repo, &commit_id)); cl_git_pass(git_branch_create(&branch, repo, "some/deep/ref", commit, 0)); git_commit_free(commit); diff --git a/tests/libgit2/refs/branches/iterator.c b/tests/libgit2/refs/branches/iterator.c index e086681e5..a295d553b 100644 --- a/tests/libgit2/refs/branches/iterator.c +++ b/tests/libgit2/refs/branches/iterator.c @@ -11,7 +11,7 @@ void test_refs_branches_iterator__initialize(void) cl_fixture_sandbox("testrepo.git"); cl_git_pass(git_repository_open(&repo, "testrepo.git")); - cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); + cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL)); } diff --git a/tests/libgit2/refs/create.c b/tests/libgit2/refs/create.c index 01eb62a52..1dafcf61a 100644 --- a/tests/libgit2/refs/create.c +++ b/tests/libgit2/refs/create.c @@ -34,7 +34,7 @@ void test_refs_create__symbolic(void) const char *new_head_tracker = "ANOTHER_HEAD_TRACKER"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); /* Create and write the new symbolic reference */ cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0, NULL)); @@ -77,7 +77,7 @@ void test_refs_create__symbolic_with_arbitrary_content(void) const char *new_head_tracker = "ANOTHER_HEAD_TRACKER"; const char *arbitrary_target = "ARBITRARY DATA"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); /* Attempt to create symbolic ref with arbitrary data in target * fails by default @@ -124,7 +124,7 @@ void test_refs_create__deep_symbolic(void) const char *new_head_tracker = "deep/rooted/tracker"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_git_pass(git_reference_symbolic_create(&new_reference, g_repo, new_head_tracker, current_head_target, 0, NULL)); cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, new_head_tracker)); @@ -145,7 +145,7 @@ void test_refs_create__oid(void) const char *new_head = "refs/heads/new-head"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); /* Create and write the new object id reference */ cl_git_pass(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL)); @@ -180,7 +180,7 @@ void test_refs_create__oid_unknown_succeeds_without_strict(void) const char *new_head = "refs/heads/new-head"; - git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644"); + git_oid__fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(git_libgit2_opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, 0)); @@ -201,7 +201,7 @@ void test_refs_create__oid_unknown_fails_by_default(void) const char *new_head = "refs/heads/new-head"; - git_oid_fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644"); + git_oid__fromstr(&id, "deadbeef3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); /* Create and write the new object id reference */ cl_git_fail(git_reference_create(&new_reference, g_repo, new_head, &id, 0, NULL)); @@ -215,7 +215,7 @@ void test_refs_create__propagate_eexists(void) git_oid oid; /* Make sure it works for oid and for symbolic both */ - cl_git_pass(git_oid_fromstr(&oid, current_master_tip)); + cl_git_pass(git_oid__fromstr(&oid, current_master_tip, GIT_OID_SHA1)); cl_git_fail_with(GIT_EEXISTS, git_reference_create(NULL, g_repo, current_head_target, &oid, false, NULL)); cl_git_fail_with(GIT_EEXISTS, git_reference_symbolic_create(NULL, g_repo, "HEAD", current_head_target, false, NULL)); } @@ -227,7 +227,7 @@ void test_refs_create__existing_dir_propagates_edirectory(void) const char *dir_head = "refs/heads/new-dir/new-head", *fail_head = "refs/heads/new-dir"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); /* Create and write the new object id reference */ cl_git_pass(git_reference_create(&new_reference, g_repo, dir_head, &id, 1, NULL)); @@ -242,7 +242,7 @@ static void test_invalid_name(const char *name) git_reference *new_reference; git_oid id; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_assert_equal_i(GIT_EINVALIDSPEC, git_reference_create( &new_reference, g_repo, name, &id, 0, NULL)); @@ -272,7 +272,7 @@ static void test_win32_name(const char *name) git_oid id; int ret; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); ret = git_reference_create(&new_reference, g_repo, name, &id, 0, NULL); @@ -314,7 +314,7 @@ static void count_fsyncs(size_t *create_count, size_t *compress_count) p_fsync__cnt = 0; - 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/fsync_test", &id, 0, "log message")); git_reference_free(ref); diff --git a/tests/libgit2/refs/delete.c b/tests/libgit2/refs/delete.c index 42cc534b5..edb521f4a 100644 --- a/tests/libgit2/refs/delete.c +++ b/tests/libgit2/refs/delete.c @@ -63,7 +63,7 @@ void test_refs_delete__packed_only(void) git_oid id; const char *new_ref = "refs/heads/new_ref"; - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); /* Create and write the new object id reference */ cl_git_pass(git_reference_create(&ref, g_repo, new_ref, &id, 0, NULL)); diff --git a/tests/libgit2/refs/foreachglob.c b/tests/libgit2/refs/foreachglob.c index b208a95a2..a586ca08c 100644 --- a/tests/libgit2/refs/foreachglob.c +++ b/tests/libgit2/refs/foreachglob.c @@ -11,7 +11,7 @@ void test_refs_foreachglob__initialize(void) cl_fixture_sandbox("testrepo.git"); cl_git_pass(git_repository_open(&repo, "testrepo.git")); - cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); + cl_git_pass(git_oid__fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1)); cl_git_pass(git_reference_create(&fake_remote, repo, "refs/remotes/nulltoken/master", &id, 0, NULL)); } diff --git a/tests/libgit2/refs/iterator.c b/tests/libgit2/refs/iterator.c index a4f9e62ec..f40d35d11 100644 --- a/tests/libgit2/refs/iterator.c +++ b/tests/libgit2/refs/iterator.c @@ -1,6 +1,7 @@ #include "clar_libgit2.h" #include "refs.h" #include "vector.h" +#include "odb.h" static git_repository *repo; @@ -126,7 +127,7 @@ void test_refs_iterator__empty(void) git_reference *ref; git_repository *empty; - cl_git_pass(git_odb_new(&odb)); + cl_git_pass(git_odb__new(&odb, NULL)); cl_git_pass(git_repository_wrap_odb(&empty, odb)); cl_git_pass(git_reference_iterator_new(&iter, empty)); diff --git a/tests/libgit2/refs/lookup.c b/tests/libgit2/refs/lookup.c index 01e956de2..2b8be77f8 100644 --- a/tests/libgit2/refs/lookup.c +++ b/tests/libgit2/refs/lookup.c @@ -43,7 +43,7 @@ void test_refs_lookup__oid(void) git_oid tag, expected; 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_git_pass(git_oid__fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08", GIT_OID_SHA1)); cl_assert_equal_oid(&expected, &tag); } diff --git a/tests/libgit2/refs/peel.c b/tests/libgit2/refs/peel.c index 38f3465a0..fefd2d260 100644 --- a/tests/libgit2/refs/peel.c +++ b/tests/libgit2/refs/peel.c @@ -32,7 +32,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_git_pass(git_oid__fromstr(&expected_oid, expected_sha, GIT_OID_SHA1)); cl_assert_equal_oid(&expected_oid, git_object_id(peeled)); cl_assert_equal_i(expected_type, git_object_type(peeled)); diff --git a/tests/libgit2/refs/races.c b/tests/libgit2/refs/races.c index 476789358..bf46b760e 100644 --- a/tests/libgit2/refs/races.c +++ b/tests/libgit2/refs/races.c @@ -27,8 +27,8 @@ void test_refs_races__create_matching_zero_old(void) git_reference *ref; git_oid id, zero_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&zero_id, "0000000000000000000000000000000000000000"); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&zero_id, "0000000000000000000000000000000000000000", GIT_OID_SHA1); cl_git_fail(git_reference_create_matching(&ref, g_repo, refname, &id, 1, &zero_id, NULL)); git_reference_free(ref); @@ -45,8 +45,8 @@ void test_refs_races__create_matching(void) git_reference *ref, *ref2, *ref3; git_oid id, other_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&other_id, other_commit_id); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1); cl_git_fail_with(GIT_EMODIFIED, git_reference_create_matching(&ref, g_repo, refname, &other_id, 1, &other_id, NULL)); @@ -64,8 +64,8 @@ void test_refs_races__symbolic_create_matching(void) git_reference *ref, *ref2, *ref3; git_oid id, other_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&other_id, other_commit_id); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1); cl_git_fail_with(GIT_EMODIFIED, git_reference_symbolic_create_matching(&ref, g_repo, "HEAD", other_refname, 1, other_refname, NULL)); @@ -83,8 +83,8 @@ void test_refs_races__delete(void) git_reference *ref, *ref2; git_oid id, other_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&other_id, other_commit_id); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1); /* We can delete a value that matches */ cl_git_pass(git_reference_lookup(&ref, g_repo, refname)); @@ -116,8 +116,8 @@ void test_refs_races__switch_oid_to_symbolic(void) git_reference *ref, *ref2, *ref3; git_oid id, other_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&other_id, other_commit_id); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1); /* Removing a direct ref when it's currently symbolic should fail */ cl_git_pass(git_reference_lookup(&ref, g_repo, refname)); @@ -145,8 +145,8 @@ void test_refs_races__switch_symbolic_to_oid(void) git_reference *ref, *ref2, *ref3; git_oid id, other_id; - git_oid_fromstr(&id, commit_id); - git_oid_fromstr(&other_id, other_commit_id); + git_oid__fromstr(&id, commit_id, GIT_OID_SHA1); + git_oid__fromstr(&other_id, other_commit_id, GIT_OID_SHA1); /* Removing a symbolic ref when it's currently direct should fail */ cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/symref")); diff --git a/tests/libgit2/refs/read.c b/tests/libgit2/refs/read.c index a622c770b..7253cf137 100644 --- a/tests/libgit2/refs/read.c +++ b/tests/libgit2/refs/read.c @@ -82,7 +82,7 @@ void test_refs_read__symbolic(void) cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_assert_equal_oid(&id, git_object_id(object)); git_object_free(object); @@ -110,7 +110,7 @@ void test_refs_read__nested_symbolic(void) cl_assert(object != NULL); cl_assert(git_object_type(object) == GIT_OBJECT_COMMIT); - git_oid_fromstr(&id, current_master_tip); + git_oid__fromstr(&id, current_master_tip, GIT_OID_SHA1); cl_assert_equal_oid(&id, git_object_id(object)); git_object_free(object); 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); diff --git a/tests/libgit2/refs/revparse.c b/tests/libgit2/refs/revparse.c index 56af3c939..02ffe005d 100644 --- a/tests/libgit2/refs/revparse.c +++ b/tests/libgit2/refs/revparse.c @@ -652,7 +652,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void) git_repository *repo; git_reference *branch; git_object *target; - char sha[GIT_OID_HEXSZ + 1]; + char sha[GIT_OID_SHA1_HEXSIZE + 1]; repo = cl_git_sandbox_init("testrepo.git"); @@ -661,7 +661,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_described_tag(void) cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); cl_git_pass(git_branch_create(&branch, repo, "blah-7-gc47800c", (git_commit *)target, 0)); - git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target)); + git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target)); test_object_inrepo("blah-7-gc47800c", sha, repo); @@ -690,7 +690,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void) git_repository *repo; git_reference *branch; git_object *target; - char sha[GIT_OID_HEXSZ + 1]; + char sha[GIT_OID_SHA1_HEXSIZE + 1]; repo = cl_git_sandbox_init("testrepo.git"); @@ -699,7 +699,7 @@ void test_refs_revparse__try_to_retrieve_sha_before_branch(void) cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); cl_git_pass(git_branch_create(&branch, repo, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", (git_commit *)target, 0)); - git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target)); + git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target)); test_object_inrepo("a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", repo); test_object_inrepo("heads/a65fedf39aefe402d3bb6e24df4d4f5fe4547750", sha, repo); @@ -726,7 +726,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void) git_repository *repo; git_reference *branch; git_object *target; - char sha[GIT_OID_HEXSZ + 1]; + char sha[GIT_OID_SHA1_HEXSIZE + 1]; repo = cl_git_sandbox_init("testrepo.git"); @@ -735,7 +735,7 @@ void test_refs_revparse__try_to_retrieve_branch_before_abbrev_sha(void) cl_git_pass(git_revparse_single(&target, repo, "HEAD~3")); cl_git_pass(git_branch_create(&branch, repo, "c47800", (git_commit *)target, 0)); - git_oid_tostr(sha, GIT_OID_HEXSZ + 1, git_object_id(target)); + git_oid_tostr(sha, GIT_OID_SHA1_HEXSIZE + 1, git_object_id(target)); test_object_inrepo("c47800", sha, repo); diff --git a/tests/libgit2/refs/transactions.c b/tests/libgit2/refs/transactions.c index 50c102ad0..98ae6f73a 100644 --- a/tests/libgit2/refs/transactions.c +++ b/tests/libgit2/refs/transactions.c @@ -21,7 +21,7 @@ void test_refs_transactions__single_ref_oid(void) git_reference *ref; git_oid id; - git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); + git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1); cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master")); cl_git_pass(git_transaction_set_target(g_tx, "refs/heads/master", &id, NULL, NULL)); @@ -52,7 +52,7 @@ void test_refs_transactions__single_ref_mix_types(void) git_reference *ref; git_oid id; - git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); + git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1); cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master")); cl_git_pass(git_transaction_lock_ref(g_tx, "HEAD")); @@ -90,7 +90,7 @@ void test_refs_transactions__single_create(void) cl_git_pass(git_transaction_lock_ref(g_tx, name)); - git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); + git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1); cl_git_pass(git_transaction_set_target(g_tx, name, &id, NULL, NULL)); cl_git_pass(git_transaction_commit(g_tx)); @@ -104,7 +104,7 @@ void test_refs_transactions__unlocked_set(void) git_oid id; cl_git_pass(git_transaction_lock_ref(g_tx, "refs/heads/master")); - git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); + git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1); cl_git_fail_with(GIT_ENOTFOUND, git_transaction_set_target(g_tx, "refs/heads/foo", &id, NULL, NULL)); cl_git_pass(git_transaction_commit(g_tx)); } @@ -122,7 +122,7 @@ void test_refs_transactions__error_on_locking_locked_ref(void) cl_git_pass(git_transaction_lock_ref(g_tx_with_lock, "refs/heads/master")); /* lock reference for set_target */ - cl_git_pass(git_oid_fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750")); + cl_git_pass(git_oid__fromstr(&id, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", GIT_OID_SHA1)); cl_git_fail_with(GIT_ELOCKED, git_transaction_lock_ref(g_tx, "refs/heads/master")); cl_git_fail_with(GIT_ENOTFOUND, git_transaction_set_target(g_tx, "refs/heads/master", &id, NULL, NULL)); |