summaryrefslogtreecommitdiff
path: root/tests/libgit2/refs
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-17 13:40:37 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-14 22:29:57 -0400
commit0acaf3a8eb7c3276b7864df8f5588c7007b38f35 (patch)
treea5f6a678339651be6c9681f84a489950d34b9fb2 /tests/libgit2/refs
parentdbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (diff)
downloadlibgit2-0acaf3a8eb7c3276b7864df8f5588c7007b38f35.tar.gz
oid: define GIT_OID_SHA1_ZERO
Callers should not assume the layout of the oid structure; provide them a macro that defines the null / zero sha1 object id.
Diffstat (limited to 'tests/libgit2/refs')
-rw-r--r--tests/libgit2/refs/branches/delete.c4
-rw-r--r--tests/libgit2/refs/reflog/drop.c4
-rw-r--r--tests/libgit2/refs/reflog/messages.c6
-rw-r--r--tests/libgit2/refs/reflog/reflog.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/tests/libgit2/refs/branches/delete.c b/tests/libgit2/refs/branches/delete.c
index 27995f9e2..2c2eae272 100644
--- a/tests/libgit2/refs/branches/delete.c
+++ b/tests/libgit2/refs/branches/delete.c
@@ -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,7 +150,7 @@ 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;
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..9bff6647d 100644
--- a/tests/libgit2/refs/reflog/messages.c
+++ b/tests/libgit2/refs/reflog/messages.c
@@ -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);
@@ -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..2674f039d 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);