summaryrefslogtreecommitdiff
path: root/tests/libgit2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libgit2')
-rw-r--r--tests/libgit2/blame/getters.c10
-rw-r--r--tests/libgit2/core/oidmap.c12
-rw-r--r--tests/libgit2/iterator/workdir.c2
-rw-r--r--tests/libgit2/object/tree/update.c32
-rw-r--r--tests/libgit2/object/tree/write.c2
-rw-r--r--tests/libgit2/odb/backend/simple.c2
-rw-r--r--tests/libgit2/odb/mixed.c4
-rw-r--r--tests/libgit2/online/clone.c2
-rw-r--r--tests/libgit2/online/push_util.c2
-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
-rw-r--r--tests/libgit2/status/worktree.c2
14 files changed, 42 insertions, 44 deletions
diff --git a/tests/libgit2/blame/getters.c b/tests/libgit2/blame/getters.c
index 66eaeecf9..c160cd383 100644
--- a/tests/libgit2/blame/getters.c
+++ b/tests/libgit2/blame/getters.c
@@ -10,11 +10,11 @@ void test_blame_getters__initialize(void)
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
git_blame_hunk hunks[] = {
- { 3, {{0}}, 1, NULL, {{0}}, "a", 0},
- { 3, {{0}}, 4, NULL, {{0}}, "b", 0},
- { 3, {{0}}, 7, NULL, {{0}}, "c", 0},
- { 3, {{0}}, 10, NULL, {{0}}, "d", 0},
- { 3, {{0}}, 13, NULL, {{0}}, "e", 0},
+ { 3, GIT_OID_SHA1_ZERO, 1, NULL, GIT_OID_SHA1_ZERO, "a", 0},
+ { 3, GIT_OID_SHA1_ZERO, 4, NULL, GIT_OID_SHA1_ZERO, "b", 0},
+ { 3, GIT_OID_SHA1_ZERO, 7, NULL, GIT_OID_SHA1_ZERO, "c", 0},
+ { 3, GIT_OID_SHA1_ZERO, 10, NULL, GIT_OID_SHA1_ZERO, "d", 0},
+ { 3, GIT_OID_SHA1_ZERO, 13, NULL, GIT_OID_SHA1_ZERO, "e", 0},
};
g_blame = git_blame__alloc(NULL, opts, "");
diff --git a/tests/libgit2/core/oidmap.c b/tests/libgit2/core/oidmap.c
index 6854e3432..7f549fc18 100644
--- a/tests/libgit2/core/oidmap.c
+++ b/tests/libgit2/core/oidmap.c
@@ -93,9 +93,9 @@ void test_core_oidmap__get_fails_with_nonexisting_key(void)
void test_core_oidmap__setting_oid_persists(void)
{
git_oid oids[] = {
- {{ 0x01 }},
- {{ 0x02 }},
- {{ 0x03 }}
+ { { 0x01 }},
+ { { 0x02 }},
+ { { 0x03 }}
};
cl_git_pass(git_oidmap_set(g_map, &oids[0], "one"));
@@ -110,9 +110,9 @@ void test_core_oidmap__setting_oid_persists(void)
void test_core_oidmap__setting_existing_key_updates(void)
{
git_oid oids[] = {
- {{ 0x01 }},
- {{ 0x02 }},
- {{ 0x03 }}
+ { { 0x01 }},
+ { { 0x02 }},
+ { { 0x03 }}
};
cl_git_pass(git_oidmap_set(g_map, &oids[0], "one"));
diff --git a/tests/libgit2/iterator/workdir.c b/tests/libgit2/iterator/workdir.c
index 86b847cab..112cd9a4e 100644
--- a/tests/libgit2/iterator/workdir.c
+++ b/tests/libgit2/iterator/workdir.c
@@ -1481,7 +1481,7 @@ void test_iterator_workdir__hash_when_requested(void)
git_iterator *iter;
const git_index_entry *entry;
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t i;
struct merge_index_entry expected[] = {
diff --git a/tests/libgit2/object/tree/update.c b/tests/libgit2/object/tree/update.c
index 41b50f3e9..4e1191db1 100644
--- a/tests/libgit2/object/tree/update.c
+++ b/tests/libgit2/object/tree/update.c
@@ -21,7 +21,7 @@ void test_object_tree_update__remove_blob(void)
const char *path = "README";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -50,7 +50,7 @@ void test_object_tree_update__remove_blob_deeper(void)
const char *path = "subdir/README";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -80,8 +80,8 @@ void test_object_tree_update__remove_all_entries(void)
const char *path2 = "subdir/subdir2/new.txt";
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path1},
- { GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB /* ignored */, path2},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path1},
+ { GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB /* ignored */, path2},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -112,7 +112,7 @@ void test_object_tree_update__replace_blob(void)
git_index_entry entry = { {0} };
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, path},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, path},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -153,9 +153,9 @@ void test_object_tree_update__add_blobs(void)
};
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[0]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[1]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[2]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[0]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[1]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[2]},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -210,9 +210,9 @@ void test_object_tree_update__add_blobs_unsorted(void)
};
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[0]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[1]},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, paths[2]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[0]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[1]},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, paths[2]},
};
cl_git_pass(git_oid_fromstr(&base_id, "c4dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b"));
@@ -258,8 +258,8 @@ void test_object_tree_update__add_conflict(void)
int i;
git_oid tree_updater_id;
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir/blob"},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir"},
};
for (i = 0; i < 2; i++) {
@@ -274,8 +274,8 @@ void test_object_tree_update__add_conflict2(void)
int i;
git_oid tree_updater_id;
git_tree_update updates[] = {
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_BLOB, "a/dir/blob"},
- { GIT_TREE_UPDATE_UPSERT, {{0}}, GIT_FILEMODE_TREE, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "a/dir/blob"},
+ { GIT_TREE_UPDATE_UPSERT, GIT_OID_SHA1_ZERO, GIT_FILEMODE_TREE, "a/dir/blob"},
};
for (i = 0; i < 2; i++) {
@@ -290,7 +290,7 @@ void test_object_tree_update__remove_invalid_submodule(void)
git_tree *baseline;
git_oid updated_tree_id, baseline_id;
git_tree_update updates[] = {
- {GIT_TREE_UPDATE_REMOVE, {{0}}, GIT_FILEMODE_BLOB, "submodule"},
+ {GIT_TREE_UPDATE_REMOVE, GIT_OID_SHA1_ZERO, GIT_FILEMODE_BLOB, "submodule"},
};
/* This tree contains a submodule with an all-zero commit for a submodule named 'submodule' */
diff --git a/tests/libgit2/object/tree/write.c b/tests/libgit2/object/tree/write.c
index a4ceb35b6..5088a9680 100644
--- a/tests/libgit2/object/tree/write.c
+++ b/tests/libgit2/object/tree/write.c
@@ -516,7 +516,7 @@ void test_object_tree_write__object_validity(void)
void test_object_tree_write__invalid_null_oid(void)
{
git_treebuilder *bld;
- git_oid null_oid = {{0}};
+ git_oid null_oid = GIT_OID_SHA1_ZERO;
cl_git_pass(git_treebuilder_new(&bld, g_repo, NULL));
cl_git_fail(git_treebuilder_insert(NULL, bld, "null_oid_file", &null_oid, GIT_FILEMODE_BLOB));
diff --git a/tests/libgit2/odb/backend/simple.c b/tests/libgit2/odb/backend/simple.c
index 6c9293ac0..d2051f821 100644
--- a/tests/libgit2/odb/backend/simple.c
+++ b/tests/libgit2/odb/backend/simple.c
@@ -237,7 +237,7 @@ void test_odb_backend_simple__null_oid_is_ignored(void)
{ "0000000000000000000000000000000000000000", "null oid content" },
{ NULL, NULL }
};
- git_oid null_oid = {{0}};
+ git_oid null_oid = GIT_OID_SHA1_ZERO;
git_odb_object *obj;
setup_backend(objs);
diff --git a/tests/libgit2/odb/mixed.c b/tests/libgit2/odb/mixed.c
index cbab8e362..70eda8237 100644
--- a/tests/libgit2/odb/mixed.c
+++ b/tests/libgit2/odb/mixed.c
@@ -186,7 +186,7 @@ static void assert_found_objects(git_odb_expand_id *ids)
num = ARRAY_SIZE(expand_id_test_data);
for (i = 0; i < num; i++) {
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t expected_len = 0;
git_object_t expected_type = 0;
@@ -204,7 +204,7 @@ static void assert_found_objects(git_odb_expand_id *ids)
static void assert_notfound_objects(git_odb_expand_id *ids)
{
- git_oid expected_id = {{0}};
+ git_oid expected_id = GIT_OID_SHA1_ZERO;
size_t num, i;
num = ARRAY_SIZE(expand_id_test_data);
diff --git a/tests/libgit2/online/clone.c b/tests/libgit2/online/clone.c
index dfaee0e85..a9e98dfca 100644
--- a/tests/libgit2/online/clone.c
+++ b/tests/libgit2/online/clone.c
@@ -629,7 +629,7 @@ void test_online_clone__ssh_cannot_change_username(void)
static int ssh_certificate_check(git_cert *cert, int valid, const char *host, void *payload)
{
git_cert_hostkey *key;
- git_oid expected = {{0}}, actual = {{0}};
+ git_oid expected = GIT_OID_SHA1_ZERO, actual = GIT_OID_SHA1_ZERO;
GIT_UNUSED(valid);
GIT_UNUSED(payload);
diff --git a/tests/libgit2/online/push_util.c b/tests/libgit2/online/push_util.c
index cd1831d4c..94919e9b2 100644
--- a/tests/libgit2/online/push_util.c
+++ b/tests/libgit2/online/push_util.c
@@ -2,8 +2,6 @@
#include "vector.h"
#include "push_util.h"
-const git_oid OID_ZERO = {{ 0 }};
-
void updated_tip_free(updated_tip *t)
{
git__free(t->name);
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);
diff --git a/tests/libgit2/status/worktree.c b/tests/libgit2/status/worktree.c
index 00c6ec2d5..5bd3987c1 100644
--- a/tests/libgit2/status/worktree.c
+++ b/tests/libgit2/status/worktree.c
@@ -744,7 +744,7 @@ void test_status_worktree__conflict_has_no_oid(void)
git_index_entry entry = {{0}};
git_status_list *statuslist;
const git_status_entry *status;
- git_oid zero_id = {{0}};
+ git_oid zero_id = GIT_OID_SHA1_ZERO;
entry.mode = 0100644;
entry.path = "modified_file";